You shouldn't have conditions in there. You're describing an
association between 2 models, not options for eg. pagination. Jobs
that are > 2 weeks old should still be associated with Recruiter (I'm
guessing is the other model).

Put those conditions in the controller's $paginate var or whatever
find() call you're making where you only want new Jobs.

On Mon, Jun 22, 2009 at 12:10 PM, abest11<[email protected]> wrote:
>
> Hi,
> Im a newbie to Cake, so apologies in advance if this is a silly
> question.  I am trying to use a simple hasMany model association with
> a condition on a date field, so that only "Jobs" created in the last
> two weeks are returned.  In my model, I have:
>
> var $hasMany = array(
>        'Job' => array(
>                'className' => 'Job',
>                'foreignKey' => 'recruiter_id',
>                'conditions' => array("Job.created >" => date('Y-m-d', 
> strtotime("-2
> weeks"))),
>        )
> );
>
> This is based off the manual "Complex Find Conditions" topic.
>
> For some reason, I keep getting the error
> "Parse error: syntax error, unexpected '.', expecting ')'" for the
> line which defines the conditions...
>
> I can't seem to figure out whats wrong with my syntax. Im using the
> latest version of Cake.
>
> Thanks!
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to