Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You need to use Doctrine subclasses. Create a subclass for each namespace. This will let you reference a specific set of data by class name.</p> <ul> <li>class Models_Price <ul> <li>subclass Models_Price_CD</li> <li>subclass Models_Price_DVD</li> <li>subclass Models_Price_Vinyl</li> </ul></li> </ul> <p>In the Price class, you'll need to specify the following:</p> <pre><code>public function setUp() { parent::setUp(); $this-&gt;setSubclasses( array( 'Price_CD' =&gt; array( 'media_namespace' =&gt; 'CD', ), 'Price_DVD' =&gt; array( 'media_namespace' =&gt; 'DVD', ), 'Price_Vinyl' =&gt; array( 'media_namespace' =&gt; 'Vinyl', ), ) ); } </code></pre> <p>Let's make the assumption that ItemsOne uses namespace CD, ItemsTwo uses namespace DVD, and ItemsThree uses namespace Vinyl. </p> <p>For this situation, you would add the following relationship to each class:</p> <p>ItemsOne: </p> <pre><code>$this-&gt;hasMany( 'Models_Price_CD as Prices', array( 'local' =&gt; 'id', 'foreign' =&gt; 'entity_id', ) ); </code></pre> <p>ItemsTwo: </p> <pre><code>$this-&gt;hasMany( 'Models_Price_DVD as Prices', array( 'local' =&gt; 'id', 'foreign' =&gt; 'entity_id', ) ); </code></pre> <p>ItemsThree: </p> <pre><code>$this-&gt;hasMany( 'Models_Price_Vinyl as Prices', array( 'local' =&gt; 'id', 'foreign' =&gt; 'entity_id', ) ); </code></pre> <p>Now, each of the Prices relations will return only what you expect. Doctrine, seeing the subclass, will automatically namespace all the queries you perform on that table.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload