Your methodology for the id field is against normal database usage. The 'normal' way is to use NULL as 'not assigned to any parent', or 'uknown' for the field.
You would have to make the field 'not required' in order to get it to accept NULL You would have to modify queries regarding NULL values. BUT, it is the logical value for 'no trip assigned', or 'not associated with any trip' On Oct 9, 1:17 am, Avani <[email protected]> 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---
