You can use an array to specify conditions on searches
http://manual.cakephp.org/view/449/find/
$users = $this->Model->findAll(array('User.companies_id' =>
$_SESSION['user']));
$users = $this->Model->find('list', array('conditions' =>
array('User.companies_id' => $_SESSION['user'])));
You may also want to look into the Session Component.
Good luck!
On Apr 30, 10:09 pm, validkeys <[EMAIL PROTECTED]>
wrote:
> Lets say that i have a model company and a model employees. A company
> has many employees. If I want to specify in the user model the
> following condition:
>
> 'condition' => 'User.companies_id = ' . $_SESSION['user']
> ['companies_id']
>
> I get an error that PHP wasn't expecting the period. This would be
> useful (I THINK) from a data security standpoint in that all queries
> using the user and company model would limit the users return to users
> with the current user's company id.
>
> What am I doing wrong here? Is this even going to do what i want it
> to?
>
> Thanks in advance
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---