title: symfony2 - extend a base entity class or keep entities unrelated?
body: <p>I have a symfony2 project which includes half a dozen major entity types. I'm using Doctrine.</p>
  
  <p>These entities have a number of identical fields, such as creatorId, Created, Updated, Status, and Title. At the moment, each entity is separately defined - so of course there's much duplication of basic code (and db fields as well).</p>
  
  <p>I am learning OOP as I learn symfony2, so I'm groping here, but my question is this:</p>
  
  <p>Is it considered best practice to keep each entity as a self-contained class? Or would it be preferable to create a new base class for the shared properties, and then have the other entities extend the base entity?</p>
  
  <p>bonus question:</p>
  
  <p>And if it is in fact better to build entities that inherit from a parent class, I can vaguely visualize two options:</p>
  
  <p>1) the parent class is a fully mapped Doctrine entity, with its own table in the database, which we will call, oh let's call it "Nodes". So calling a child entity will always involve an additional Join between the Nodes table and the Child content type entity table.</p>
  
  <p>2) the parent class is an - um - abstract class (?), defining the shared properties of the other entities, but not having an actual database presence. Each child entity implements the shared properties separately, so that the DB structure remains identical to my current setup, but there is (presumably) less duplication of code when defining entities.</p>
  
  <p>I'm mostly looking for advice on the overall question - child entities extending a base entity, or just separate entities. Not expecting anyone to explain the best implementation though hints are welcome. </p>