0

I have a number of different types of content containers that I use in different ways. They have all the same properties so I can use the same class, but since I use them differently, I am thinking of a way to do that nicely.

In my relational-database-way of thinking I would use an int-flag to mark the container as either of type geoarea or building or individual server (these are my containers).

Now I am wondering if symfony doesn't offer a smoother way of doing this, let's say child entities? If I could define a class (entity) "container" and use as a base for the actual entities? Or am I way off track here...

I am new to symfony2 and fairly new to object oriented programming but not to web development...

Matt Welander
  • 8,234
  • 24
  • 88
  • 138

1 Answers1

2

You can use inheritance. It's one of principal concept in object oriented programming : Inheritance

Take a look on Docrine Inheritance Entity : Inheritance Mapping

Jérôme Boé
  • 2,752
  • 4
  • 21
  • 32