Inside the _findByConditions function return statement, try
'conditions'=>$conditions instead of just $conditions

Lucca Mordente

On 11 abr, 23:19, cricket <[email protected]> wrote:
> using 1.2.6
>
> Cake seems to be rewriting my find() conditions. Consider the
> following:
>
> public function findByID($id)
> {
>         return $this->_findByConditions(
>                 array('conditions' => array('Member.id' => $id))
>         );
>
> }
>
> public function findBySlug($slug)
> {
>         return $this->_findByConditions(
>                 array('conditions' => array('User.slug' => $slug))
>         );
>
> }
>
> protected function _findByConditions($conditions = array())
> {
>         //debug($conditions);
>         return $this->find(
>                 'first',
>                 array(
>                         'fields' => array('*'),
>                         $conditions,
>                         'contain' => array(...)
>                 )
>         );
>
> }
>
> debug() shows that $conditions is the 'User.slug' array but the SQL
> query has WHERE `Member`.`id` = '[THE SLUG]'
>
> What gives?! Any ideas how to go about debugging this? I've been
> poring over Model::find() without any idea.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using "remove me" as the subject.

Reply via email to