I think you may want to check out the 'finder query'  and adjust it
for each of your test and command models.

On Dec 21, 5:05 pm, Ralle <test_cb4...@yahoo.dk> wrote:
> I think CakePHP has a really clever way to do this, so instead of
> reinventing the wheel, i'd ask you guys. I've used the search feature
> and read through the api.
> I have the folowing models
>
> Project
> Suite belongsTo Project
> Test belongsTo Suite
> Command belongsTo Test
>
> At the login screen of the app you chose the project and the
> project_id is stored in the session variable.
> After that i want all models that in any way has a relation the
> Project to only return data from that project.
> Say i wanted to list all Tests, it should add something like this to
> the sql "WHERE test.suite_id = suite.id AND suite.project_id=34"
> For commands this would be "WHERE commands.test_id = test.id AND
> tests.suite_id = suite.id AND suites.project_id=34"
>
> I tried adding a beforeFind function to the project model
> function beforeFind($queryData){
> $queryData['conditions']['project_id'] = $_SESSION['project_id'];
> return $queryData;}
>
> Didn't work as the function wasn't being called when another model
> called the project object, eg. Command or Test
>
> Cheers, Ralle
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to