[MODM-149] Fix PHPDoc @return types in various places Created: 05/Jul/11  Updated: 05/Apr/12

Status: Open
Project: Doctrine MongoDB ODM
Component/s: Document Manager
Affects Version/s: 1.0.0BETA3
Fix Version/s: None

Type: Documentation Priority: Critical
Reporter: Dayson Pais Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

In certain PHPDoc blocks for functions, the @return type is not of the right type. This causes auto-completion issues in various IDEs (I'm using PhpStorm).

For example, in \Doctrine\ODM\MongoDB\DocumentManager on line #341 the ->createQueryBuilder($documentName = null) function.

/**

  • Create a new Query instance for a class.
    *
  • @param string $documentName The document class name.
  • @return Document\ODM\MongoDB\Query <--------------------------- MUST BE Query\Builder !
    */
    public function createQueryBuilder($documentName = null) { return new Query\Builder($this, $this->cmd, $documentName); }


 Comments   
Comment by Lee Davis [ 05/Apr/12 ]

This appears to be fixed in 1.0.0BETA4-DEV

Line 357 in Doctrine\ODM\MongoDB\DocumentManager...

/**

  • Create a new Query instance for a class.
    *
  • @param string $documentName The document class name.
  • @return Query\Builder
    */
    public function createQueryBuilder($documentName = null) { return new Query\Builder($this, $this->cmd, $documentName); }




[MODM-116] Collection Per Class Inheritance : Documents of a child class referenced in a parent class may be saved to the parent collection Created: 07/Feb/11  Updated: 21/Apr/11

Status: Reopened
Project: Doctrine MongoDB ODM
Component/s: Document Manager
Affects Version/s: 1.0.0BETA3
Fix Version/s: None

Type: Bug Priority: Critical
Reporter: JF Bustarret Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Here is my class hierarchy (classes & attributes renamed for a better understanding) :

 
/** @Document @InheritanceType("COLLECTION_PER_CLASS") **/
class Parent {
    /** @ReferenceOne(targetDocument="Child") **/
    protected $child;
}

/** @Document **/
class Child extends Parent {
}

When doing :

$parent->setXXX($value);
$parent->getChild()->setXXX($value2)

the $parent->getChild() document is saved to the Parent collection.

It looks like the problems lies in UnitOfWork::executeUpdates :

 
if (get_class($document) == $className || $document instanceof Proxy && $document instanceof $className) {

$child_document is an instance of Proxy (ChildProxy) and also an instance of Parent => saved using the Parent persister.

Shouldn't the test be : get_class($document) == $className || get_class($document) == $className_of_Proxy ?

As a side note : why "if ($class->isEmbeddedDocument)

{ continue; }

" is within the foreach and not a "if ($class->isEmbeddedDocument)

{ return; }

" at the beginning of the method ?



 Comments   
Comment by Jonathan H. Wage [ 11/Feb/11 ]

I added a test for this here and it appears to be passing: https://github.com/doctrine/mongodb-odm/commit/3f24d77cc04adc0bb5532333e33826100457c666

Comment by JF Bustarret [ 11/Feb/11 ]

I'll try to get more info on the problem and provide a test for it.

Comment by JF Bustarret [ 28/Mar/11 ]

Here is a new test case :

 
/** @Document
 *  @InheritanceType("COLLECTION_PER_CLASS")
 **/
class MODM116Parent
{
    /** @Id */
    private $id;

    /** @String */
    private $name;

    /** @ReferenceOne **/
    private $child;

    public function getId()
    {
        return $this->id;
    }

    public function getName()
    {
        return $this->name;
    }

    public function setName($name)
    {
        $this->name = $name;
    }

    public function getChild()
    {
        return $this->child;
    }

    public function setChild(MODM116Child $child)
    {
        $this->child = $child;
    }
}

/** @Document **/
class MODM116Child extends MODM116Parent
{
    
    /** @EmbedMany(targetDocument="MODM116Embedded") **/
    protected $embedded;
    
    function addEmbedded($parent) {
        $this->embedded[] = new MODM116Embedded($parent);
    }
}

/** @EmbeddedDocument **/
class MODM116Embedded {
    
    /** @ReferenceOne(targetDocument="MODM116Parent") **/
    protected $parent;
    
    public function __construct($parent) {
        $this->parent = $parent;
    }
    
}


$parent = new MODM116Parent();
$parent->setName('test');
$parent->setChild(new MODM116Child());
$dm->persist($parent->getChild());
$dm->persist($parent);
$dm->flush();
$dm->clear();

$parent = $dm->getRepository(get_class($parent))->findOneBy(array('name' => 'test'));

$parent->getChild()->setName('ok');
$parent->getChild()->addEmbedded($parent);
$dm->flush();
Comment by JF Bustarret [ 30/Mar/11 ]

Pulled the last version from git. The bug still exists.

Comment by JF Bustarret [ 21/Apr/11 ]

Up. Any news on a fix ?





[MODM-153] "Near" Query does not work. Created: 10/Aug/11  Updated: 20/Feb/12

Status: Open
Project: Doctrine MongoDB ODM
Component/s: None
Affects Version/s: 1.0.0BETA2
Fix Version/s: None

Type: Bug Priority: Critical
Reporter: Dmitry Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

"Near" statement does not work for me. The following code returns all cities from collection:

$cities = $this->dm->createQuery('City')
    ->field('coordinates')->near(50, 60)
    ->execute();

Could you please fix it?



 Comments   
Comment by mark wright [ 02/Sep/11 ]

It also does not work in beta3 but it fails differently. It never returns anything.

$places = $documentManager->createQueryBuilder('Documents\Place')
->field('point')
->near(36.5788494, -121.7207804)
->getQuery()
->execute();

This returns 0 documents even though I have a point at 36.5788493, -121.7207805. Doctrine\MongoDB\Query\Builder::near() only takes one argument so the Y value is ignored. However, the docblock specifies 2 params.

Comment by Tim Sakharchuk [ 04/Sep/11 ]

Hi All,

Here is correct realization of this function in
Doctrine\MongoDB\Query\Builder

public function near($x, $y)

{ $this->query['type'] = Query::TYPE_GEO_LOCATION; $this->query['near'] = array($x, $y); return $this; }

When may this fix appear in Doctrine ODM?

Thanks!

Comment by Shane A. Stillwell [ 20/Feb/12 ]

I had the same issue on 1.0.0.BETA3.

The solution was to change the query up a little.

$places = $this->dm->createQueryBuilder('\Application\Event')->field('latitude')->near(50)->field('longitude')->near(60)->getQuery()->execute(); 

http://stackoverflow.com/a/9015906/179335





[MODM-82] Add New Attribute "idGetter" to allow accessing the ID without triggering lazy-load Created: 29/Sep/10  Updated: 04/Mar/11

Status: Open
Project: Doctrine MongoDB ODM
Component/s: Proxies
Affects Version/s: 1.0.0BETA2
Fix Version/s: 1.1.0

Type: New Feature Priority: Major
Reporter: Thomas Adam Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

access the ID of a proxy without loading it.

See DDC-687






[MODM-152] Single Collection Inheritance mapping does NOT work if the subclasses are in a different namespace Created: 09/Jul/11  Updated: 09/Jul/11

Status: Open
Project: Doctrine MongoDB ODM
Component/s: Mapping Drivers
Affects Version/s: 1.0.0BETA3
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Dayson Pais Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

I have described the issue in detail here: https://github.com/doctrine/mongodb-odm/issues/124






[MODM-151] Missing Annotation class HasLifecycleCallbacks Created: 07/Jul/11  Updated: 07/Jul/11

Status: Open
Project: Doctrine MongoDB ODM
Component/s: Mapping Drivers
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Miloslav "adrive" Kmet Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

latest MongoDB ODM from git master repository



 Description   

Annotation class HasLifecycleCallbacks is missing in Doctrine\ODM\MongoDB\Mapping\Annotations






[MODM-150] XSD file for XML mappings is incomplete Created: 07/Jul/11  Updated: 07/Jul/11

Status: Open
Project: Doctrine MongoDB ODM
Component/s: Mapping Drivers
Affects Version/s: 1.0.0BETA3
Fix Version/s: None

Type: Bug Priority: Major
Reporter: alcaeus Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 1
Labels: None

Attachments: Text File doctrine-mongo-mapping.xsd.patch    

 Description   

The XSD file for XML mappings (http://www.doctrine-project.org/schemas/odm/doctrine-mongo-mapping.xsd) appears to be incomplete:

  • Only document is allowed as root tag, not mapped-superclass or embedded-document
  • The name attribute for the document tag is not allowed according to the XSD file
  • The fieldName, index and unique attributes for the field tag is not allowed according to the XSD file

These are the problems I discovered at the moment, I haven't yet checked for more problems. The XSD file probably needs a bigger update.

Attached is a patch file that adds the missing attributes, I haven't dug into Doctrine enough to create the mapped-superclass or embedded-document tags.






[MODM-148] Do not add '$db' in reference when referencing document from same $db Created: 02/Jun/11  Updated: 02/Jun/11

Status: Open
Project: Doctrine MongoDB ODM
Component/s: Document Manager
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Vladimir Razuvaev Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

When using ReferenceOne or ReferenceMany , doctrine will create fully-qualified reference to the object (with all fields: '$id', '$ref', '$db') even when reference is within same $db.

This approach causes several problems: for example we use mongo database as a template for new clients - when new client registers, template database is copied for him. But since it contains hardcoded $db - copy operation becomes resource consuming, since we have to loop through every document of every collection and fix $db reference.

Also maintenance suffers, since you can't easily rename database when required.

Is it possible to omit $db part when referencing document from same db?






[MODM-147] No possibility to get a json object by a working document with toArray method (inluding all the embedded documents as arrays) Created: 28/May/11  Updated: 28/May/11

Status: Open
Project: Doctrine MongoDB ODM
Component/s: Collections
Affects Version/s: 1.0.0BETA3
Fix Version/s: None

Type: New Feature Priority: Major
Reporter: Stephan Salat Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 1
Labels: None
Environment:

Irrelevant



 Description   

Description of the problem here:

http://stackoverflow.com/questions/6155189/doctrine-odm-mongodb-get-a-complete-array-of-an-object

Problem with the unincisive toArray() method.






[MODM-142] DocumentRepository::findBy() not compatible with interface Created: 07/May/11  Updated: 07/May/11

Status: Open
Project: Doctrine MongoDB ODM
Component/s: Document Repositories
Affects Version/s: 1.0.0BETA3
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Jan Pieper Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

I want to get a document repository for my Document\Event document class but instead i get a fatal error.

Pseudo
<?php

use Doctrine\MongoDB\Connection;
use Doctrine\ODM\MongoDB\DocumentManager;
use Doctrine\ODM\MongoDB\Configuration;
use Documents\Event;

$manager = new DocumentManager(
    new Connection(...),
    new Configuration(...)
);

$manager->getRepository('Documents\Event');

Fatal error: Declaration of Doctrine\ODM\MongoDB\DocumentRepository::findBy() must be compatible with that of Doctrine\Common\Persistence\ObjectRepository::findBy() in /home/jpieper/Workspace/Jersey/vendor/doctrine-common/lib/Doctrine/ODM/MongoDB/DocumentRepository.php on line 39

DoctrineCommonPersistenceObjectRepository.php (github@5a285537)
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null);
DoctrineODMMongoDBDocumentRepository.php (github@8d02e843)
public function findBy(array $criteria) { ... }

See https://github.com/doctrine/common/commit/5a2855372834cf37e0408e80dcb9a9c97ec1d352#lib/Doctrine/Common/Persistence






[MODM-141] Doctrine ODM: Documentation error Created: 26/Apr/11  Updated: 26/Apr/11

Status: Open
Project: Doctrine MongoDB ODM
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Documentation Priority: Major
Reporter: Diego Lewin Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

not applicable



 Description   

I think that is a documentation issue, in http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/query-builder-api.html (15.3. Modifier Operations) the queries are like:

$dm->createQueryBuilder('User')

>field('password')>set('newpassword')

>field('username')>equals('jwage')

->getQuery()
->execute();

But it is missing the update(), it should be like:

$dm->createQueryBuilder('User')

->update()
>field('password')>set('newpassword')

>field('username')>equals('jwage')

->getQuery()
->execute();

All the queries in that section have similar issue






[MODM-140] Issue with nested embdedded documents after adding an EmbeddedDocument to Document Created: 14/Apr/11  Updated: 19/Dec/11

Status: Open
Project: Doctrine MongoDB ODM
Component/s: UnitOfWork
Affects Version/s: 1.0.0BETA3
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Andrew Cobby Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 5
Labels: None
Environment:

PHP 5.3.3, Mac OS X 10.6.6, MongoDB 1.8.0


Attachments: File doctrine-odm-patch-1.0.0beta3.diff     File MODM140Test.php    

 Description   

I'm using the latest version of Doctrine ODM (fresh from Git).

I have three levels of Documents (Two embedded); Category -> EmbedsMany: Post -> EmbedsMany PostVersion.

Step-by-step:

1. Make a new Post (Post1), 2 PostVersions (PostVersion1 and 2) and a Category
2. Add Post1 to Category
3. Persist Category, Flush, Clear
4. Retrieve Category
5. Make a new Post (Post2) and 2 PostVersions(PostVersion3 and 4)
6. Add Post2 to Category
7. Flush

If you're following properly, at this stage in the database there should be:
1 Category,
2 Posts
4 PostVersions ... 2 PostVersions in each Post

However, what actually happens is:
1 Category,
2 Posts
4 PostVersions ... 4 PostVersions in Post1, 0 PostVersions in Post2

On StackOverflow: http://bit.ly/ekFbe2
Testcase Gist: https://gist.github.com/920914

A work around is to make Post2 and add it to Category, flush, then make new PostVersions and flush again.

I did some debugging but I don't know enough about the internals to fix the issue.



 Comments   
Comment by Andrew Cobby [ 14/Apr/11 ]

Failing test

Comment by Andrew Cobby [ 14/Apr/11 ]

Added a test using the EmbdeddedTestLevelX Documents, please refer to Gist: https://gist.github.com/920914

For some reason, they work? I'm thinking maybe this isn't a bug... very confused at the moment.

Comment by Andras Revai [ 18/Jun/11 ]

I've got the same problem.

Comment by Kelvin Wood [ 09/Aug/11 ]

I had a similar problem, and resolved it with the attached patch (based on the 1.0.0beta3 release).

This patch causes the ODM to stop scanning for changes further down the heirachy once it finds a new object, and then ensures that the Persistence Builder will include all contents of the new item.

Comment by Richard Shank [ 19/Dec/11 ]

Kevin, do you want to put a PR in on github for this?





[MODM-138] Field's name attribute does not work for the update queries Created: 07/Apr/11  Updated: 07/Apr/11

Status: Open
Project: Doctrine MongoDB ODM
Component/s: None
Affects Version/s: 1.0.0BETA3
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Başar Aykut Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Documents

class Test 
{
.
.
.
/**
 * @EmbedOne(targetDocument="Location", name="l")
*/
private $location;
.
.
.
}

/** @EmbeddedDocument */
class Location
{
    /**
	 * @Field(type="float", name="y")
	 */
    public $lat;

    /**
	 * @Field(type="float", name="x")
	 */
    public $lng;

	public function __construct($latitude,$longitude) {
		$this->lat = $latitude;
		$this->lng = $longitude;
	}
}

Update query:

$dm->createQueryBuilder('Test')
->update()
->field('id')->equals(123)
->field('l')->set(new Location(39, 32);
->getQuery(array('upsert' => true))
->execute();

Result of this query is

"l": {
    "lat": 39,
    "lng": 32
},

however, it should be

"l": {
    "y": 39,
    "x": 32
},

also field function can support field name of the class on update queries, as follows

$dm->createQueryBuilder('Test')
->update()
->field('id')->equals(123)
->field('location')->set(new Location(39, 32);
->getQuery(array('upsert' => true))
->execute();





[MODM-139] [PATCH] @ReferenceMany with no referenceMapping cannot handle DBRef in all / in queries Created: 08/Apr/11  Updated: 08/Apr/11

Status: Open
Project: Doctrine MongoDB ODM
Component/s: Document Manager
Affects Version/s: 1.0.0BETA3
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Gérald Croes Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 1
Labels: None
Environment:

Linux, PHP 5.3



 Description   

I have thoose examples :

/** @Document 
 * @InheritanceType("SINGLE_COLLECTION")
 * @DiscriminatorField(fieldName="type")
 * @DiscriminatorMap({"Test\Product"="Product", "Test\Year"="Year"})
*/
Attributes {
   /** @Id */
   protected $_id;
}

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

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

/**
 * Classe de base pour les différents contenus
 * @Document
 * @InheritanceType("SINGLE_COLLECTION")
 * @DiscriminatorField(fieldName="type")
 * @DiscriminatorMap({"Test\Document"="Document", "Test\Infos"="Infos"})  
 */
class Content
{
   /** protected $_id */
    /** @ReferenceMany */
    protected $_attributes;
}

And the querying stuff

//and the query : 
$queryBuilder = $dm->createQueryBuilder('Test\DOcument');
//...
$attribute1Ref = $dm->createDBRef($attribute1Object);
$attribute2Ref = $dm->createDBRef($attribute2Object);
$queryBuilder->field('_attributes')->all(array($attribute1Ref, $attribute2Ref));
$queryBuilder->getQuery()->execute();//Won't work as the generated query won't specify the "_doctrine_class_name" value.

Proposed patch in DocumentManager :

    /**
     * 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->getClassMetadata($className);
        $id = $this->unitOfWork->getDocumentIdentifier($document);

        $dbRef = array(
            $this->cmd . 'ref' => $class->getCollection(),
            $this->cmd . 'id'  => $class->getDatabaseIdentifierValue($id),
            $this->cmd . 'db'  => $this->getDocumentDatabase($className)->getName()
        );

        // add a discriminator value if the referenced document is not mapped explicitely to a targetDocument
        if ($referenceMapping && ! isset($referenceMapping['targetDocument'])) {
            $discriminatorField = isset($referenceMapping['discriminatorField']) ? $referenceMapping['discriminatorField'] : '_doctrine_class_name';
            $discriminatorValue = isset($referenceMapping['discriminatorMap']) ? array_search($class->getName(), $referenceMapping['discriminatorMap']) : $class->getName();
            $dbRef[$discriminatorField] = $discriminatorValue;
+        }  elseif ($referenceMapping === null) {
+            $dbRef['_doctrine_class_name'] = $class->getName();
+        }
        return $dbRef;
    }





[MODM-128] Upserts in Query builder Created: 23/Feb/11  Updated: 23/Feb/11

Status: Open
Project: Doctrine MongoDB ODM
Component/s: None
Affects Version/s: 1.0.0BETA2
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Billy Bob Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Mac OS X + MAMP



 Description   

It seems that if you just call upsert(true) in a update request, it won't be enough. You have to calm getQuery(array('upsert' => true)) as well in order to have the 'insert if not exist' working.






[MODM-129] Storing embeded documents containing embeded documents, already persistet in another collection fails Created: 25/Feb/11  Updated: 25/Feb/11

Status: Open
Project: Doctrine MongoDB ODM
Component/s: None
Affects Version/s: 1.0.0BETA3
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Kolja Treutlein Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None

Attachments: GZip Archive testcase.tar.gz    

 Description   

We persist a document a1 containing an embedded document a1.1 which itself contains another embedded document a1.1.1. When the embedded document a1.1 is moved to another document of another collection b1 and needs to get persisted as embedded document b1.1 the embedded document a1.1.1 (which is now part of b1.1, too) is not saved as an embedded document of b1.1.

Example: We use a version object which contains a pageversion as an embedded document. This page object contains multiple elements (stored as embedded documents) which themselves contain several parameter objects (stored as embedded document of elements). Now assume we have such a persisted version and want to "copy" the pageversion in another collection. So we generate a new page object, and add to this page all elements of the persisted pageversion. If we now persist this page, the representation in mongodb contains all elements but not any parameters, which should be part of the page as well (as they are part of an element).



 Comments   
Comment by Kolja Treutlein [ 25/Feb/11 ]

Testcase

Comment by Jonathan H. Wage [ 25/Feb/11 ]

Try cloning the embedded document when you move it. The reason why you have issues most likely is because internally inside Doctrine we keep track of each embedded document instance and what parent document it is attached to. So when you move it, Doctrine gets confused. You need to move it by cloning so the embedded document is actually a new object instance to Doctrine.





[MODM-157] Github-PR-151 by l3pp4rd: fixes triggering fatal error on preupdate event in case changeset is clea Created: 25/Aug/11  Updated: 19/Sep/11

Status: Open
Project: Doctrine MongoDB ODM
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of

{username}

:

Url: https://github.com/doctrine/mongodb-odm/pull/151

Message:

fixes triggering fatal error on preupdate event in case changeset is cleared during onFlush

similar issue is fixed in ORM it should be supported on ODM mongodb also



 Comments   
Comment by Dmitry Strygin [ 19/Sep/11 ]

Hmm... The bug is still actual for ORM layer in master.

Comment by Vladimir Garvardt [ 19/Sep/11 ]

Got the same issue for ORM in 2.1.1 and same in master. Made a fix based on fix for ODM and pull request on github.

URL: https://github.com/doctrine/doctrine2/pull/126

PS: maybe new issue should be created in Doctrine 2 - ORM project for this issue





[MODM-156] Github-PR-152 by vladar: Property ClassMetadata::file is not serialized Created: 25/Aug/11  Updated: 25/Aug/11

Status: Open
Project: Doctrine MongoDB ODM
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of

{username}

:

Url: https://github.com/doctrine/mongodb-odm/pull/152

Message:

This is causing errors, when saving gridfs files with persistent metadata cache engine (like apc, memcached, etc).

I've also found same bug in Jira - http://www.doctrine-project.org/jira/browse/MODM-132 but seems that it is not fixed yet.

Added fix + tests.






[MODM-154] Github-PR-150 by tecbot: [XMLDriver] fixed an error in hydration classes when the name is not equal to the fieldName Created: 21/Aug/11  Updated: 21/Aug/11

Status: Open
Project: Doctrine MongoDB ODM
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of

{username}

:

Url: https://github.com/doctrine/mongodb-odm/pull/150

Message:






[MODM-155] Github-PR-148 by roed: fixed generating of classes Created: 21/Aug/11  Updated: 21/Aug/11

Status: Open
Project: Doctrine MongoDB ODM
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of

{username}

:

Url: https://github.com/doctrine/mongodb-odm/pull/148

Message:

fixed the generating of classes based on xml files, changed ClassMetadata to ClassMetadataInfo in these files (as in the ORM tool/mapping)

the following did not work, but works after these changes:
$cmf = new \Doctrine\ODM\MongoDB\Tools\DisconnectedClassMetadataFactory();
$cmf->setDocumentManager($this->_dm);
$cmf->setConfiguration($this->_dm->getConfiguration());
$driver = $this->_dm->getConfiguration()->getMetadataDriverImpl();

$metadatas = $cmf->getAllMetadata(); //this would break it

// $this->_dm is an instance of Doctrine\ODM\MongoDB\DocumentManager






[MODM-162] Introduction Tutorial,suitable version Created: 15/Feb/12  Updated: 15/Feb/12

Status: Open
Project: Doctrine MongoDB ODM
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Documentation Priority: Major
Reporter: Hugues Leunsa Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

software



 Description   

HI all,

I am working on a project where I would like to use mongoDB ODM. But while following this tutotorial : http://docs.doctrine-project.org/projects/doctrine-mongodb-odm/en/latest/reference/introduction.html, it appears to me that the download odm library doesn't work with the code: missing code or undefined classes. Therefore I woulld like to know what's the corresponding version mongodb ODM of the tutorial.

Thank's in advance

regards

near






[MODM-161] Bug with index definition Created: 06/Feb/12  Updated: 15/Jun/12

Status: Open
Project: Doctrine MongoDB ODM
Component/s: Mapping Drivers
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Erwann Mest Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

MacOS 10.7.2



 Description   

All is there: https://gist.github.com/1682981



 Comments   
Comment by Luis Cordova [ 15/Jun/12 ]

github link has nothing it was removed

Comment by Luis Cordova [ 15/Jun/12 ]

gist is a broken link





[MODM-159] Querying a collection by Embedded objects identifier not working. Created: 30/Nov/11  Updated: 30/Nov/11

Status: Open
Project: Doctrine MongoDB ODM
Component/s: Persister
Affects Version/s: 1.0.0BETA3
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Dahuda Unal Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

OS:10.8.0 OSX
PHP Official Version 5.3.8
MongoDB : 2.0.1



 Description   

Reference objects identifiers are stored as '$id' in database when Embedded objects identifiers are stored as '_id'. When querying a collection by embedded objects identifier, DocumentPersister->prepareQueryValue() converts it to '$id' although it is stored in DB as '_id'. So querying for reference object ids work but embedded objects do not.

DocumentPersister->prepareQueryValue() first checks if field has TargetDocument mapping, if it is true it checks if field is target document's identifier, if this also returns true
it prepares the field as '$id' without looking at if it is Embedded or Reference object ... If TargetDocument it is a Reference object it works since Reference objects identifiers are stored as '$id' but if TargetDocument is Embedded object, query returns empty as theres no field such '$id' in EmbeddedObject, identifier is '_id' instead..

Is this a bug / issue or am i missing something?






[MODM-158] Doctrine\ODM\MongoDB\Mapping\Type\TimestampType should use MongoDate instead of MongoTimestamp Created: 24/Nov/11  Updated: 24/Nov/11

Status: Open
Project: Doctrine MongoDB ODM
Component/s: Mapping Drivers
Affects Version/s: 1.0.0BETA3
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Shane A. Stillwell Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

OS 10.7

PHP 5.3.6 with Suhosin-Patch (cli) (built: Sep 8 2011 19:34:00)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
with Xdebug v2.1.2, Copyright (c) 2002-2011, by Derick Rethans


Attachments: Text File mongodate.patch    

 Description   

When using the @Timestamp mapping type for a class Doctrine uses MongoTimestamp and it creates very incorrect times in the DB. According to PHP documentation, you should not use MongoTimestamp for creating timestamps, instead MongoDate should be used.

I've attached a patch that changes it to MongoDate and this works splendid when you assign a timestamp to a @Timestamp value

	/**
	 * @Field(type="timestamp")
	 */
	protected $created_on;

	/**
	 * @Field(type="timestamp")
	 */
	protected $updated_on;

	public function __construct($options = NULL)
	{
		$this->created_on = $this->updated_on = time();
		parent::__construct($options);
	}





[MODM-164] DocumentPersister's prepareQuery() method is not suitable for preparing newObj for update queries Created: 05/Apr/12  Updated: 05/Apr/12

Status: Open
Project: Doctrine MongoDB ODM
Component/s: Persister
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Juha Suni Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Doctrine\ODM\MongoDB\Query\Expr::getNewObj() uses Doctrine\ODM\MongoDB\Persisters\DocumentPersister::prepareQuery() method for preparing newObj. However, prepareQuery is not suitable for that.

The first lines in prepareQuery method should apply to find queries only:


if (is_scalar($query) || $query instanceof \MongoId) {
$query = array('_id' => $query);
}
if ($this->class->hasDiscriminator() && ! isset($query[$this->class->discriminatorField['name']])) {
$discriminatorValues = $this->getClassDiscriminatorValues($this->class);
$query[$this->class->discriminatorField['name']] = array('$in' => $discriminatorValues);
}


Recommendation: DocumentPersister should introduce a new method, such as prepareNewObj($newObj) for preparing the newObj array. Expr::getNewObj() should be change to invoke the new method.






[MODM-137] Undefined index 'criteria' in DocumentPersister Created: 04/Apr/11  Updated: 04/Apr/11

Status: Open
Project: Doctrine MongoDB ODM
Component/s: Persister
Affects Version/s: 1.0.0BETA3
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Kevin Bradwick Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

On the master branch, a notice is thrown on line 531 of the DocumentPersister for an undefined index 'criteria'. This is when using the Yaml driver.

https://github.com/doctrine/mongodb-odm/blob/master/lib/Doctrine/ODM/MongoDB/Persisters/DocumentPersister.php#L531

Full notice:
Notice: Undefined index: criteria in /Doctrine/ODM/MongoDB/Persisters/DocumentPersister.php on line 531
PHP Warning: array_merge(): Argument #2 is not an array in /Doctrine/ODM/MongoDB/Persisters/DocumentPersister.php on line 532

Warning: array_merge(): Argument #2 is not an array in /Doctrine/ODM/MongoDB/Persisters/DocumentPersister.php on line 532
PHP Catchable fatal error: Argument 1 passed to Doctrine\MongoDB\Collection::find() must be an array, null given, called in Doctrine/ODM/MongoDB/Persisters/DocumentPersister.php on line 533 and defined in Doctrine/MongoDB/Collection.php on line 169

Catchable fatal error: Argument 1 passed to Doctrine\MongoDB\Collection::find() must be an array, null given, called in Doctrine/ODM/MongoDB/Persisters/DocumentPersister.php on line 533 and defined in /Doctrine/MongoDB/Collection.php on line 169






[MODM-136] Document's fields names are not properly converted to database names in a query Created: 27/Mar/11  Updated: 27/Mar/11

Status: Open
Project: Doctrine MongoDB ODM
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Eugene Leonovich Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 1
Labels: None


 Description   

Mappings:

/**
 * @Field(type="date", name="scheduled_at")
 */
private $scheduledAt;

/**
 * @Field(type="date", name="completed_at")
 */
private $completedAt;

Query:

$qb->field('scheduledAt')->lte($now)
   ->addOr($qb->expr()->field('completedAt')->lte($now))
   ->addOr($qb->expr()->field('completedAt')->equals(null))
   ->sort('scheduledAt', 'asc');

Expected result:

db.foo.find({
    "scheduled_at": { "$lte": new Date(...) }, 
    "$or": [ 
        { "completed_at": {  "$lte": new Date(...) } }, 
        { "completed_at": null } ] 
})
.sort({ "scheduled_at": 1 });

Actual result:

db.foo.find({
    "scheduled_at": { "$lte": new Date(...) }, 
    "$or": [ 
        { "completedAt": {  "$lte": new Date(...) } }, 
        { "completedAt": null } ] 
})
.sort({ "scheduledAt": 1 });





[MODM-134] Reference added twice Created: 24/Mar/11  Updated: 25/Mar/11

Status: Open
Project: Doctrine MongoDB ODM
Component/s: None
Affects Version/s: 1.0.0BETA3
Fix Version/s: None

Type: Bug Priority: Major
Reporter: jules b Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

I have a listener who listens on onFlush event,
i have a document and change a property (integer) in it and call $uow->recomputeSingleDocumentChangeSet().
The result is that all references are added twice.

If i remove the call to $uow->recomputeSingleDocumentChangeSet() all is fine.

Here's my document (notice references added twice on children property):

array (
'children' =>
array (
0 =>
array (
'$ref' => 'block',
'$id' => new MongoId("4d8b663638b6180803000005"),
'$db' => 'app_jules',
'_doctrine_class_name' => 'Design\\PageBundle\\Document
StrategyBlock',
),
1 =>
array (
'$ref' => 'block',
'$id' => new MongoId("4d8b663638b6180803000005"),
'$db' => 'app_jules',
'_doctrine_class_name' => 'Design\\PageBundle\\Document
StrategyBlock',
)
),
'order' => 0,
'parent' =>
array (
'$ref' => 'block',
'$id' => new MongoId("4d8b663638b6180803000003"),
'$db' => 'app_jules',
'_doctrine_class_name' => 'Design\\PageBundle\\Document
ContainerBlock',
),
'type' => 'container',
)

EDIT: if i clear() the $children ArrayCollection before calling $uow->recomputeSingleDocumentChangeSet() all is fine

I tried to reproduce it in a test-case but the result wasn't successful






[MODM-132] Doctrine\ODM\MongoDB\Mapping\ClassMetaData is loosing "file" property after serialization Created: 18/Mar/11  Updated: 18/Mar/11

Status: Open
Project: Doctrine MongoDB ODM
Component/s: Mapping Drivers
Affects Version/s: 1.0.0BETA3
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Andrei S Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

After ClassMetaData is awakened it looses the "file" property and that breaks our File model.
File::count() returns 0

I dumped ClassMetaData object with caching enabled and disabled. Here's the diff:

146c146
< [file] =>

> [file] => file
149a150,180
> [0] => Array
> (
> [keys] => Array
> (
> [uploaded_at] => 1
> )
>
> [options] => Array
> (
> [safe] => true
> [unique] =>
> )
>
> )
>

The first line is the missing file value. The second block appears to be missing indexes but I'm guessing this information should not be serialized.






[MODM-131] Notice in Doctrine\MongoDB\GridFS::doInsert Created: 09/Mar/11  Updated: 09/Mar/11

Status: Open
Project: Doctrine MongoDB ODM
Component/s: None
Affects Version/s: 1.0.0BETA3
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Vitaliy Kaplich Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

CentOS 5.5, PHP 5.3



 Description   

Notice: Undefined variable: file in /projects/tbi/vendors/doctrine/odm/lib/vendor/doctrine-mongodb/lib/Doctrine/MongoDB/GridFS.php on line 112






[MODM-135] [Cursor] ReferenceMany sort mapping not working Created: 25/Mar/11  Updated: 26/Mar/11

Status: Open
Project: Doctrine MongoDB ODM
Component/s: None
Affects Version/s: 1.0.0BETA3
Fix Version/s: None

Type: Bug Priority: Major
Reporter: jules b Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 1
Labels: None
Environment:

Macosx


Attachments: Zip Archive MODM135.zip    

 Description   

I have a document like this:

/** @Document */
class Page
{
/** @Id */
protected $id;

/** @ReferenceMany(sort=

{"order"="asc"}

) */
protected $blocks;
}

If i have well understood things, i can do:

$blocks = $dm->getRepository('Page')>find($id)>getBlocks();

blocks should now be sorted by $order property.

This behaviour doesn't seems to work (or maybe i'm missing something).
In the attachment there's a test case

i made the priority major because in my case i haven't found a workaround (i'm using nested referenceMany, a child can have children, which can have children, ..).






[MODM-170] Unique index on embedded document Created: 15/May/13  Updated: 15/May/13

Status: Open
Project: Doctrine MongoDB ODM
Component/s: Persister
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Szymon Karnecki Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Hi,

Bug checked on versions:
doctrine/mongodb-odm (1.0.0-BETA7)
doctrine/mongodb-odm-bundle (v3.0.0-BETA3)
and
doctrine/mongodb-odm (dev-master 6fd7a46)
doctrine/mongodb-odm-bundle (dev-master 23c08a4)

I've created unique index on embedded document and ODM seem not to be working properly. When unique index is violated MongoCursorException is thrown and this behavior is desired.
But, the document sometimes is persisted anyway. Document structure is invalid.

Thrown exception:
mymongoserver.xx:27017: E11000 duplicate key error index: prj.Grid.$boxes_offer_$id_1_boxes_tag_$id_1 dup key: { : ObjectId('51555bbe31bcb2c70e000001'), : "dom" }

Grid document sketch:

{ _id: boxes:[DBref(Offer), DBref(Offer), DBref(Offer)] tag: DBref(Tag) }

unique index on boxes.tag

Any help would be appreciated.






[MODM-145] QueryBuilder references() to does not support references on embedded objects' fields Created: 23/May/11  Updated: 25/Oct/11

Status: Open
Project: Doctrine MongoDB ODM
Component/s: Query Builder
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Minor
Reporter: Jeremy Mikola Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

I noticed that the references() method does not support fields on embedded objects, as the argument to the preceding field() method will be passed into getFieldMapping() and trigger an exception. I suppose a solution would require multiple calls to getFieldMapping() in order to dive into the embedded object's class metadata.

To demonstrate, below is an example of a UserRepository class. The User document contains an embeddedObject that itself references another User:

class UserRepository extends DocumentRepository
{ 
    public function findByEmbeddedObjectReference(User $user)
    {
        return $this->createQueryBuilder()
            ->field('embeddedObject.user.$id')->equals($user->getId())
//          ->field('embeddedObject.user')->references($user)
            ->getQuery()
            ->execute();
    }
}

Using field()/equals() works fine as an alternative to references(), so there is no urgent need for this feature.



 Comments   
Comment by Nicolas Brignol [ 25/Oct/11 ]

Hi

It seems that we have a problem with the temporary solution proposed :
Doctrine remove the "$id" part in our query :

   obj->field('embedded.referenced.$id')->equals($reference->getId())

will generate the query without "$id".
There is no problem when the reference is directly in the requested object.

Did someone experience this issue ?





[MODM-144] Bi-Directional References Feature Created: 18/May/11  Updated: 18/May/11

Status: Open
Project: Doctrine MongoDB ODM
Component/s: None
Affects Version/s: 1.0.0BETA3
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Jan Gantzert Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Zend Framework 1.11.6



 Description   

I cant´t reproduce the Bi-Directional References with my own example or the example of the documentation.
Perhaps the documentation is not up to date or their ist a bug.

BlogPost.php
<?php

/** @Document */
class BlogPost
{
/** @Id */
public $id;

/** @String */
public $title;

/** @String */
public $content;

/** @String */
public $createtime;

/** @String */
public $updatetime;

/** @ReferenceMany(targetDocument="PostComment", mappedBy="post") */
private $comments;
}

PostComment.php
<?php

/** @Document */
class PostComment
{
/** @Id */
public $id;

/** @String */
public $name;

/** @String */
public $mail;

/** @String */
public $content;

/** @String */
public $createtime;

/** @String */
public $updatetime;

/** @ReferenceOne(targetDocument="BlogPost", inversedBy="comments") */
private $post;
}

CommentController.php
// Save the Post
$post = new BlogPost();
$post->setTitle = 'testtitle';
//$post->content = 'testcontent';
//$post->createdate = time();

$comment1 = new PostComment();
$comment1->title = 'testcommenttitle1';

$comment2 = new PostComment();
$comment2->title = 'testcommenttitle2';

$comment3 = new PostComment();
$comment3->title = 'testcommenttitle3';

$dm->persist($comment1);
$dm->persist($comment2);
$dm->persist($comment3);
$dm->flush();

echo $post->id;

/*$posts = $dm->createQueryBuilder('BlogPost')
->getQuery();*/

$post = $dm->getRepository('BlogPost')->find('4dd45739f563724c23000002');

Zend_Debug::dump($post);
$comments = $post->getComments();

------------------------
In the documentation the example is
$post1->setUser($user);
But the only working for me is:
$post->setTitle = 'testtitle';

Anyway, I can´t get the Comments from the mongodb.
I always get this error.
Fatal error: Call to undefined method BlogPost::getComments()
This is a correct error message because BlogPost really dont have a getComments()
method. How do I get my Comments then?
Any help would be great.

Greetings tronga






[MODM-127] Update queries : update() required ? Created: 23/Feb/11  Updated: 23/Feb/11

Status: Open
Project: Doctrine MongoDB ODM
Component/s: None
Affects Version/s: 1.0.0BETA2
Fix Version/s: None

Type: Documentation Priority: Minor
Reporter: Billy Bob Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

In the documentation exemples for update queries :
http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/query-builder-api.html#update-queries

it doesn't mention a update() function call any more in update queries.

Did I miss something?






[MODM-126] lessThanOrEq() renamed in lte() Created: 22/Feb/11  Updated: 22/Feb/11

Status: Open
Project: Doctrine MongoDB ODM
Component/s: None
Affects Version/s: 1.0.0BETA2
Fix Version/s: 1.0.0BETA2

Type: Documentation Priority: Minor
Reporter: Billy Bob Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

The lessThanOrEq() function referenced in the documentation does not exist ay more, it was replaced by lte().

http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/query-builder-api.html






[MODM-168] Can't Use Custom Repository Class for Embedded Doc When Using YAML Driver Created: 29/Jul/12  Updated: 29/Jul/12

Status: Open
Project: Doctrine MongoDB ODM
Component/s: Mapping Drivers
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Isaac Foster Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

When using the Yaml driver the ClassMetadata generation process won't create and use the indicated custom repository class for an embedded document. From what I can see digging into the actual code, it will work when using the Annotations or XML drivers, but in the Yaml driver the call to setCustomRepositoryClass is inside of a conditional that only gets entered if the document type is 'document'.

I'm not completely sure, but from what I can see elsewhere in the code, it looks like mapped superclasses should also be able to have a custom repository class, but can't when using the Yaml driver.

So I reckon what would work would be to change the code as indicated below:

<<EXISTING CODE>>
//Doctrine/ODM/MongoDb/Mapping/Driver/YamlDriver.php, line 66
if ($element['type'] == 'document') {
if (isset($element['repositoryClass']))

{ $class->setCustomRepositoryClass($element['repositoryClass']); }

} elseif ($element['type'] === 'mappedSuperclass')

{ $class->isMappedSuperclass = true; }

elseif ($element['type'] === 'embeddedDocument')

{ $class->isEmbeddedDocument = true; }

<<TO THIS>>
if (isset($documentAnnot->repositoryClass))

{ $class->setCustomRepositoryClass($element['repositoryClass']); }




[MODM-169] Filter API is not unified between ODM and ORM Created: 10/Dec/12  Updated: 10/Dec/12

Status: Open
Project: Doctrine MongoDB ODM
Component/s: Document Manager
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Minor
Reporter: Craig Marvelley Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Hi,

I'm implementing some functionality around filters which will ideally work for both ORM and ODM. The API for managing filters is different on `Doctrine\ORM\EntityManager` and `Doctrine\ODM\MongoDB\DocumentManager`, while the CouchDB implementation of ODM has no filter concept.

For example, ORM EntityManager has getFilters(), hasFilters(), while ODM MongoDB DocumentManager has getFilterCollection().

I was wondering what your thoughts were on defining the filter API in an interface, to improve consistency when implementing cross-library functionality?

Thanks,
Craig






[MODM-130] @ChangeTrackingPolicy notation is ignored in @MappedSuperclass Created: 02/Mar/11  Updated: 02/Mar/11

Status: Open
Project: Doctrine MongoDB ODM
Component/s: None
Affects Version/s: 1.0.0BETA1
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Vitaliy Kaplich Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

CentOS 5.5, PHP 5.3



 Description   

I am not sure if it's supposed to be that @MappedSuperclass document can define @ChangeTrackingPolicy for multiple documents but in fact it does not work.

In other words in the case below:
===================================================

/**

  • @MappedSuperclass
  • @InheritanceType("COLLECTION_PER_CLASS")
  • @ChangeTrackingPolicy("DEFERRED_EXPLICIT")
    */
    abstract class MappedDocument
    {
    }

/**

  • @Document(collection="chart")
    */
    class Chart extends MappedDocument
    {
    }

===================================================

class Chart

  • has InheritanceType = INHERITANCE_TYPE_COLLECTION_PER_CLASS which is expected
  • but ChangeTrackingPolicy = CHANGETRACKING_DEFERRED_IMPLICIT (value by default) which is NOT expected.

At the same time if to define ChangeTrackingPolicy in the Chart class instead of MappedDocument it works as expected.






[MODM-163] @ReferenceMany and Inheritance Created: 01/Mar/12  Updated: 01/Mar/12

Status: Open
Project: Doctrine MongoDB ODM
Component/s: Persister
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: julie sommerville Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

php 5.3 macosx 10.7.3 mongodb-odm 1.0 mongodb v2.0.2



 Description   

@ReferenceMany doesn't seem to work when used within a child class unless I specify @InheritanceType("CLASS_PER_COLLECTION") (which is fine b/c that works for our architecture)

Here is an example from our code:

//Parent Class

use Doctrine\Common\Collections\ArrayCollection;

/**

  • @Document(collection="homepages")
  • @ChangeTrackingPolicy("DEFERRED_IMPLICIT")
  • @Indexes({
  • @Index(keys= {"vertical"="asc","ts"="desc"}

    , safe="true"),

  • @Index(keys= {"ts"="desc"}

    , safe="true")

  • })
    */
    class Homepage extends MappedDocument
    {

//** References
/**

  • @ReferenceMany(targetDocument="Post")
  • @var list<Post>
    */
    protected $touts;

}

//Child Class
/**

  • @Document(collection="readmes")
  • @ChangeTrackingPolicy("DEFERRED_IMPLICIT")
  • @Indexes({
  • @Index(keys= {"vertical"="asc"}

    , safe="true")

  • })
    */
    class Readme extends Homepage { //** References /** * @ReferenceMany(targetDocument="Post") * @var list<Post> */ protected $more_touts; }

If I don't add the @InheritanceType annotation the $more_touts data never gets persisted into the DB.
Other types such as @ReferenceOne all work just fine






Generated at Sat May 25 06:26:18 UTC 2013 using JIRA 5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5.