hello,
Try adding: Criteria::LEFT_JOIN in addJoin method.

$c = new Criteria();
$c->add(PhotoPeer::USERID, $u->getProfile()->getUserId());
$c->addJoin (PhotoPeer::TRIPID, TripPeer::ID, Criteria::LEFT_JOIN);
$c->add(TripPeer::IS_ACTIVE,'1');


On Fri, Oct 9, 2009 at 10:17 AM, Avani <avani.v.puj...@gmail.com> wrote:

>
> Hi All,
>
> I am confused about 1 query in my symfony project.
>
> I have 2 tables as shown below.
>
> 1. photo
>           -photoid
>           -photoname
>           -userid
>           -tripid  (either 0 or  related tripid  if trip is
> assigned)
>
> 2. Trip
>           -id
>           -tripname
>           -isactive
>
> Here, for photo->tripid   it can be 0 if no trip assigned.  Else
> corresponding tripid value.
>
> Now, I dont want to display photos for inactive trips. (trip->isactive
> = false)
>
> If I write
>
> $c = new Criteria();
> $c->add(PhotoPeer::USERID, $u->getProfile()->getUserId());
> $c->addJoin (PhotoPeer::TRIPID, TripPeer::ID);
> $c->add(TripPeer::IS_ACTIVE,'1');
>
>
> Then it displays only matching records which are active. It doesn't
> display records from photo with tripid = 0.
>
> How to write condition here?
>
> Thanks in advance.
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to