thanks zaboo. I guess what i was trying to figure out was:

If in every query on the users table I need to put the condition that
the user or users returned must belong to the session company, it
seems a bit repetetive and therefore was trying to place that
condition on the model to save me some typing time. Know what i mean?

On Apr 30, 10:23 pm, zaboo <[EMAIL PROTECTED]> wrote:
> You can use an array to specify conditions on 
> searcheshttp://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 cake-php@googlegroups.com
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