On Apr 22, 3:20 am, ModByChris <[EMAIL PROTECTED]> wrote:
> Or you could use a beforeFind() to add the condition.
>
> I used that on a project that dealt with multiple finanical years. I
> changed the beforeFind() to
> alter the conditions to include the restriction of a specific year.
>
> in your case something like this in AppModel (having defined ARTIST_ID
> in bootstrap as suggested above).
>
> function beforeFind($q){
> $q['conditions'][$this->name'.artist_id'] = ARTIST_ID;
> return $q;
>
> }
This is exactly what I'm looking for. One thing, though: Is there a
way to make this sort of constraint work through associations? Like
say Artist has many Track has many File (for various downloadable
formats of each freely-downloadable track), and File does not have
artist_id, but Track does. How do I either make this condition work
through associations like that or, if nothing else, make it so it
doesn't try to apply the condition to models not directly having an
artist_id?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---