pixelmeister schrieb: > Hi @all, > > i have to solve a problem with doctrine which I normally would do with > the mysql union function. > Perhaps someone has an Idea for me, how I can do this: > > I have a few tables whitch have the following setup: > > ------------------------------------------ > table name: director > > first_name: string > last_name: string > name_slug: string > ------------------------------------------ > > table name: actor > > first_name: string > last_name: string > name_slug: string > ------------------------------------------
Why are you using different tables in the first way? Something like this would be far better I think: ------------------------------------------ table name: person id: int first_name: string last_name: string name_slug: string person_type_id: int (foreign key to person_type/id) ------------------------------------------ table name: person_type id: int type_name: string ------------------------------------------ You can always join the person_type table to persons, so you have all information and can do either queries containing all persons or only for specific types. This is also far more extensible since you can add new types any time you like. Perhaps this is not the answer you hoped for, but I think your database schema will be much better off if you change it. To honour your question though: Doctrine supports native queries, I think you would have to build one to make use of UNION. But beware that this is not only slower but also much more error prone. David --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
