The part with or should be:
'OR' => array(
   'AlbumsUser2.user_id' => null,
   'AlbumsUser2.user_id' => 1
)




On 1 Wrz, 11:36, "Mariano C." <mariano.calan...@gmail.com> wrote:
> I have to write a simple query something like:
>
> SELECT ... FROM ...
> LEFT JOIN ...
> ON (`AlbumsUser`.`album_id` = 'AlbumsUser2.album_id' AND
> ((`AlbumsUser2`.`user_id` IS NULL)  OR  (`AlbumsUser2`.`user_id` =
> 1)))
> ...
>
> this is conditions array I've write:
>
> 'conditions' => array
>                       (
>                              array('AlbumsUser.album_id' =>
> 'AlbumsUser2.album_id'),
>                              array(
>                                         'AlbumsUser2.user_id' => null,
>                                         'OR' => array('AlbumsUser2.user_id' 
> => 1)
>                                      ),
>                       ),
>
> and this is the sql that I get:
>
> ON (`AlbumsUser`.`album_id` = 'AlbumsUser2.album_id' AND
> ((`AlbumsUser2`.`user_id` IS NULL)  AND  (`AlbumsUser2`.`user_id` =
> 1)))
>
> How can I get the proper OR? Where I wrong?

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 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