title: Many-To-One with multiple target entities
body: <p>This seems simple but I can't get it right:</p>
  
  <p>There are three entities: <code>Fruit</code>, <code>Vegetable</code> and <code>Snack</code>. Snack has the fields <code>id</code>, <code>time</code> and <code>food</code>. Food is a reference to <em>either</em> one fruit <em>or</em> one vegetable. So it is basically a many-to-one/one-to-many relationship as one snack will always only hold one food. But there is more than one target entity.</p>
  
  <p>How would I map this in Doctrine2?</p>
  
  <p>A simple solution I would have used before knowing Doctrine2 would be to use two fields: <code>food_type</code> and <code>food_id</code>. But how can I make a connection from food type to the correct entity? I thought about an array of JoinColumns but can't find a way to connect the correct entity. I also had a look at mapped superclasses because there is a DiscriminatorColumn, but it also seems to be the wrong approach. If I get it right the superclass can't be an entity itself - so I cannot create a food entity.</p>
  
  <p>Any help is appreciated. I'm sure I am missing something simple here.</p>