This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

day 6: Secure the Job Page

Discussion around this tutorial for symfony 1.2-1.4

day 6: Secure the Job Page

by spitou » Mon Dec 15, 2008 1:02 pm

Hello,

Secure the job page don't work. I can not find my mistake, i have read several times the tutorial.

My apps/frontend/config/routing.yml
Code: Select all
# default rules
job:
  class:   sfPropelRouteCollection
  options: { model: JobeetJob }
   
job_show_user:
  url:     /job/:company_slug/:location_slug/:id/:position_slug
  class:   sfPropelRoute
  options:
    model: JobeetJob
    type:  object
    method_for_criteria: doSelectActive
  param:   { module: job, action: show }
  requirements:
    id: \d+


homepage:
  url:   /
  param: { module: job, action: index }

default_index:
  url:   /:module
  param: { action: index }

default:
  url:   /:module/:action/*


and my lib/model/JobeetJobPeer.php
Code: Select all
<?php

class JobeetJobPeer extends BaseJobeetJobPeer
{
  static public function getActiveJobs(Criteria $criteria = null)
  {
    if (is_null($criteria))
    {
      $criteria = new Criteria();
    }
   
    $criteria->add(JobeetJobPeer::EXPIRES_AT, time(), Criteria::GREATER_THAN);
    $criteria->addDescendingOrderByColumn(self::EXPIRES_AT);
   
    return self::doSelect($criteria);
  }

 
  static public function doSelectActive(Criteria $criteria)
  {
    $criteria->add(JobeetJobPeer::EXPIRES_AT, time(), Criteria::GREATER_THAN);
   
    return self::doSelectOne($criteria);
  }

}

if i try to get an expired job, the job is diplayed. I will not forward to a 404 page.

thank you in advance
lionel
spitou
Junior Member
 
Posts: 9
Joined: Sun Nov 23, 2008 4:33 pm

Re: day 6: Secure the Job Page

by spitou » Mon Dec 15, 2008 5:16 pm

URL with date expired:
http://jobeet.localhost/frontend_dev.php/job/sensio-labs/par is-france/42/web-developer-expired

So, the route "job_show_user" would be used.
Confirm with the debug bar "sfPatternRouting":
Match route "job_show_user" (/job/:company_slug/:location_slug/:id/:position_slug) for /job/sensio-labs/paris-france/42/web-developer-expired with parameters array ( 'module' => 'job', 'action' => 'show', 'company_slug' => 'sensio-labs', 'location_slug' => 'paris-france', 'id' => '42', 'position_slug' => 'web-developer-expired',)

But i think that i have a problem with method_for_criteria.

If i replace method_for_criteria: doSelectActive by
method_for_criteria: foo (foo don't exist). I have not an error on method_for_criteria not exist.

How can i know if the code pass in doSelectActive (lib/model/JobeetJobPeer.php) and the value of criteria?
spitou
Junior Member
 
Posts: 9
Joined: Sun Nov 23, 2008 4:33 pm

Re: day 6: Secure the Job Page

by Progenitura » Sat Dec 27, 2008 4:48 pm

Have you found a solution on this issue ? Because it's giving me headaches :(~ :-(~ :sad: .
Progenitura
Junior Member
 
Posts: 1
Joined: Thu Dec 25, 2008 6:51 pm

Re: day 6: Secure the Job Page

by erikhermeler » Mon Jan 05, 2009 3:52 pm

i'm having the same problem, any help would be great :)~ :-)~ :smile:
erikhermeler
Junior Member
 
Posts: 1
Joined: Mon Jan 05, 2009 3:32 pm

Re: day 6: Secure the Job Page

by Ravi » Tue Feb 10, 2009 4:42 pm

If method_for_criteria seems to doesn't work - change frontend/modules/job/actions/actions.class.php
method: executeShow(...)
to:

public function executeShow(sfWebRequest $request)
{
$this->article = $this->getRoute()->getObject();
}
Ravi
Junior Member
 
Posts: 10
Joined: Tue Feb 10, 2009 1:15 pm
Location: Poland

Re: day 6: Secure the Job Page

by nervus70 » Wed Feb 08, 2012 4:21 pm

Ravi wrote:If method_for_criteria seems to doesn't work - change frontend/modules/job/actions/actions.class.php
method: executeShow(...)
to:

public function executeShow(sfWebRequest $request)
{
$this->article = $this->getRoute()->getObject();
}


it work thank you :)
nervus70
Junior Member
 
Posts: 6
Joined: Sat Feb 04, 2012 8:17 pm

Re: day 6: Secure the Job Page

by medresses » Thu Mar 15, 2012 2:06 pm

It was a series of failures over time. Redudancy keeps the building up until a critical number of columns failed.
medresses
Junior Member
 
Posts: 1
Joined: Thu Mar 15, 2012 2:03 pm