<!-- 
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Sat May 25 20:24:00 UTC 2013

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary add field=key&field=summary to the URL of your request.
For example:
http://www.doctrine-project.org/jira/si/jira.issueviews:issue-xml/MODM-139/MODM-139.xml?field=key&field=summary
-->
<rss version="0.92" >
<channel>
    <title>Doctrine Project</title>
    <link>http://www.doctrine-project.org/jira</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>5.2.7</version>
        <build-number>850</build-number>
        <build-date>21-02-2013</build-date>
    </build-info>

<item>
            <title>[MODM-139] [PATCH] @ReferenceMany with no referenceMapping cannot handle DBRef in all / in queries</title>
                <link>http://www.doctrine-project.org/jira/browse/MODM-139</link>
                <project id="10044" key="MODM">Doctrine MongoDB ODM</project>
                        <description>&lt;p&gt;I have thoose examples : &lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;/** @Document 
 * @InheritanceType(&quot;SINGLE_COLLECTION&quot;)
 * @DiscriminatorField(fieldName=&quot;type&quot;)
 * @DiscriminatorMap({&quot;Test\Product&quot;=&quot;Product&quot;, &quot;Test\Year&quot;=&quot;Year&quot;})
*/
Attributes {
   /** @Id */
   protected $_id;
}

/** @Document */
class Product extends Attributes {}

/** @Document */
class Year extends Attributes {}

/**
 * Classe de base pour les diff&#233;rents contenus
 * @Document
 * @InheritanceType(&quot;SINGLE_COLLECTION&quot;)
 * @DiscriminatorField(fieldName=&quot;type&quot;)
 * @DiscriminatorMap({&quot;Test\Document&quot;=&quot;Document&quot;, &quot;Test\Infos&quot;=&quot;Infos&quot;})  
 */
class Content
{
   /** protected $_id */
    /** @ReferenceMany */
    protected $_attributes;
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And the querying stuff&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;//and the query : 
$queryBuilder = $dm-&amp;gt;createQueryBuilder(&apos;Test\DOcument&apos;);
//...
$attribute1Ref = $dm-&amp;gt;createDBRef($attribute1Object);
$attribute2Ref = $dm-&amp;gt;createDBRef($attribute2Object);
$queryBuilder-&amp;gt;field(&apos;_attributes&apos;)-&amp;gt;all(array($attribute1Ref, $attribute2Ref));
$queryBuilder-&amp;gt;getQuery()-&amp;gt;execute();//Won&apos;t work as the generated query won&apos;t specify the &quot;_doctrine_class_name&quot; value.
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Proposed patch in DocumentManager : &lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;    /**
     * Returns a DBRef array for the supplied document.
     *
     * @param mixed $document A document object
     * @param array $referenceMapping Mapping for the field the references the document
     *
     * @return array A DBRef array
     */
    public function createDBRef($document, array $referenceMapping = null)
    {
        $className = get_class($document);
        $class = $this-&amp;gt;getClassMetadata($className);
        $id = $this-&amp;gt;unitOfWork-&amp;gt;getDocumentIdentifier($document);

        $dbRef = array(
            $this-&amp;gt;cmd . &apos;ref&apos; =&amp;gt; $class-&amp;gt;getCollection(),
            $this-&amp;gt;cmd . &apos;id&apos;  =&amp;gt; $class-&amp;gt;getDatabaseIdentifierValue($id),
            $this-&amp;gt;cmd . &apos;db&apos;  =&amp;gt; $this-&amp;gt;getDocumentDatabase($className)-&amp;gt;getName()
        );

        // add a discriminator value if the referenced document is not mapped explicitely to a targetDocument
        if ($referenceMapping &amp;amp;&amp;amp; ! isset($referenceMapping[&apos;targetDocument&apos;])) {
            $discriminatorField = isset($referenceMapping[&apos;discriminatorField&apos;]) ? $referenceMapping[&apos;discriminatorField&apos;] : &apos;_doctrine_class_name&apos;;
            $discriminatorValue = isset($referenceMapping[&apos;discriminatorMap&apos;]) ? array_search($class-&amp;gt;getName(), $referenceMapping[&apos;discriminatorMap&apos;]) : $class-&amp;gt;getName();
            $dbRef[$discriminatorField] = $discriminatorValue;
+        }  elseif ($referenceMapping === null) {
+            $dbRef[&apos;_doctrine_class_name&apos;] = $class-&amp;gt;getName();
+        }
        return $dbRef;
    }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment>Linux, PHP 5.3</environment>
            <key id="12549">MODM-139</key>
            <summary>[PATCH] @ReferenceMany with no referenceMapping cannot handle DBRef in all / in queries</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="geraldcroes">G&#233;rald Croes</reporter>
                        <labels>
                    </labels>
                <created>Fri, 8 Apr 2011 06:05:31 +0000</created>
                <updated>Fri, 8 Apr 2011 08:08:17 +0000</updated>
                                    <version>1.0.0BETA3</version>
                                                <component>Document Manager</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>