title: Entity containing other entities without having a table
body: <p>I have an Entity ( Invoice ) which is purely for calculation purposes and has no table, that associates with two other entities having relations by tables. (Although there are so many other entities involved ).</p>
  
  <pre><code>class Row{
      /**
       * @var integer
       *
       * @ORM\Column(name="row_id", type="integer")
       * @ORM\Id
       * @ORM\GeneratedValue(strategy="AUTO")
       */
      private $id;
  
      /**
       * @ORM\ManyToOne(targetEntity="File")
       * @ORM\JoinColumn(name="file_id", referencedColumnName="file_id")
       */
      protected $file;
  
      /**
       * @var \DateTime
       *
       * @ORM\Column(name="date", type="date")
       */
      private $date;
  
  }
  
  class File
  {
      /**
       * @var integer
       *
       * @ORM\Column(name="file_id", type="integer")
       * @ORM\Id
       * @ORM\GeneratedValue(strategy="AUTO")
       */
      private $id;
  
      /**
       * @var string
       *
       * @ORM\Column(name="name", type="string", length=255)
       */
      private $name;
  
  
  }
  
  
  class Invoice
  {
      /**
       * @ORM\Id
       * @ORM\Column(name="invoice_id", type="integer")
       * @ORM\GeneratedValue
       */
      protected $id = null;
  
      /**
       * @ORM\OneToMany(targetEntity="Row", mappedBy="row_id")
       */
      protected $row;
  
      /**
       * @ORM\OneToMany(targetEntity="File", mappedBy="file_id")
       */
      protected $file;
  
  }
  </code></pre>
  
  <p>I want to be able to query for Invoices : </p>
  
  <pre><code>$sDate = //Some date
  $this-&gt;getEntityManager()
       -&gt;createQuery("SELECT Invoice, Row, File
                          FROM
                              ReportsEntitiesBundle:Invoice Invoice
                          LEFT JOIN
                              Row.row Row
                          LEFT JOIN
                              Row.file File
                      WHERE date=:date"
                    )
   -&gt;setParaMeter(':date', $sDate)
   -&gt;setFirstResult($iPage*$iLimit)
   -&gt;setMaxResults($iLimit)
   -&gt;getResult();
  </code></pre>
  
  <p>The questions : 
   # Doctrine tries to query the database, how can I prevent that and have it find the relevant entities?
   # How can I relate the date ( which is in Row entity and cannot be in Invoice ) to the query?</p>
  
  <p>Later this Invoice will become a part of another big entity for calculating/search purposes.</p>
  
  <p>Thank you</p>