2

How can I map multiple tables with identical structure to entity?

For example we have these tables :

  • Object_001 (id, name, lat, long)
  • Object_002 (id, name, lat, long)
  • Object_003 (id, name, lat, long)
  • ..........
  • Object_41000 (id, name, lat, long)
  • ..........
  • Object_xxxxx (id, name, lat, long)

Object Defination

class Object {
    private $id;
    private $name;
    private $lat;
    private $long;
}

I found similar problem: Doctrine 2.1 - Map entity to multiple tables and one of answer is physically merge the tables together in MySQL, but in my case I need seperated tables

Help would appreciated. Thanks.

Community
  • 1
  • 1
  • 1
    Short answer: You don't. You might try creating a view which merges your tables together but I doubt if that will work for you. – Cerad Jan 26 '15 at 15:33
  • 1
    @SeantheBean, questions are completely different, so this question is not a dublicate. The question you mention is about __merging multi table data__ into a single entity. However, what is asked here is he has n identical tables and he asks whether it is possible to map those tables into a single entity so that they are __represented by that single entity independently.__ – Lashae Nov 07 '15 at 13:31
  • 1
    Ah, sorry. I misunderstood the question. I don't think that's something Doctrine supports, so your best bet would be a workaround like what @Cerad suggested. – Sean the Bean Nov 09 '15 at 13:36

0 Answers0