Is your schema already fixed? If not, the normal way to do this would be to have m-m join tables:
NewsImage [ news_id, image_id ] EducationImage [ education_id, image_id ] HealthImage [ health_id, image_id] and remove: content_id type from the ContentImage table. Then if you want all "news" images, something like: $q = Doctrine_Query::create() ->from('ContentImage ci') ->innerJoin('NewsImage'); $newsImages = $q->execute(); or images for a particular news item: $news->getImages(); On 7 Sep, 15:30, Shihab KB <shiha...@gmail.com> wrote: > dear friends, > > I have the following tables. > > News [id, title, …] > Education [id, title…..] > Health [id, title, ….] > ContentImage [id, contented (id of the News, Education, Health), type > (like News, Education, Health), path…] > > The News, Education, Health may or may not have images in the > ContentImage table. There is no relationship is set in between News, > Education, Health table with ContentImage table. But we can link the > programatically by using id=contentid and type = 'News'. I want to > write a Doctrine query the return the left outer join between News, > Education, Health tables and ContentImage table. > > Is it possible thru dotrine query? > > Or do I need to write the query like below, > > [code] $sql = "SELECT * FROM... "; > $pdo = Doctrine_Manager::connection()->getDbh(); > $data = $pdo->query($sql)->fetchAll(); [/code] > > Please reply. -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com 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