Doctrine and inheritance

While working with Symfony of course also Doctrine crosses your way. And it is really handy in my use case: I have a MySQL database that was designed 12 years ago and contains lots of Don’ts. On of these is that there are images in a table assigned to parent entities that are located in two different tables. This is controlled by one column in the image table: AssignmentType which contains TypeA oder TypeB.

I was already thinking about moving that to two image tables when I discovered Doctrine’s single table inheritance. It is made especially for that use case and works quite perfect and your application doesn’t even know about that.

Type A

Type B





GD Star Rating