title: Matrix type mapping with Doctrine entities
body: <p>I have a bit of an issue. i am modeling a DB structure using Doctrine 2 entities and I got stuck with one relation.</p>
  
  <p>What I need to represent in the database is a matrix like table:</p>
  
  <pre><code>| |A|B|C|D|
  |A|  x
  |B|x   x
  |C|  x   x
  |D|    x
  </code></pre>
  
  <p>What the table shows is what offers are available with other offers (x=true, empty = false).
  What I tried to do is a Many to Many relationship with doctrine, hoping that this will generate a mapping table, but Doctrine does not do that.
  Here is my entity:</p>
  
  <pre><code>/** 
   * @ORM\Entity @ORM\HasLifecycleCallbacks 
   * @ORM\Entity(repositoryClass="Core\Repository\Main")
   * @ORM\Table(name="offer_availability") 
   */
  
  class OfferAvailability implements JsonSerializable
  {
  
      /**
       * @var int
       * @ORM\Id
       * @ORM\GeneratedValue(strategy="AUTO")
       * @ORM\Column(type="integer")
       */
      protected $id;
  
      /**
       * @var String
       * @ORM\Column(type="string")
       */
      protected $name;
  
      /**
       * @var \Doctrine\Common\Collections\Collection
       * @ORM\ManyToMany(targetEntity="Core\Entity\Offers\OfferAvailability", mappedBy="availableWith", inversedBy="availableWith", fetch="EXTRA_LAZY")
       */
      protected $availableWith; 
  </code></pre>
  
  <p>I know I can create the mapping table entity manually and Use One to Many relations. But what I am wondering if there is a more clever way of approaching this.</p>