[MODM-180] @DiscriminatorField("type") was not working for me Created: 12/Feb/14  Updated: 10/Apr/14

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

Type: Bug Priority: Major
Reporter: Michael Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Via nginx / mongodb (db version v2.0.4, pdfile version 4.5) I am using symfony2 (2.4.*) with

composer.json:
"php": ">=5.4.0",
"doctrine/mongodb-odm": "1.0.0-BETA9",
"doctrine/mongodb-odm-bundle": "3.0.x-dev",
"doctrine/doctrine-fixtures-bundle": "2.2.*",
"doctrine/data-fixtures": "1.0.*",
"gedmo/doctrine-extensions": "dev-wip-v2.4.0",



 Description   

According to the current documentation http://docs.doctrine-project.org/projects/doctrine-mongodb-odm/en/latest/reference/annotations-reference.html#discriminatorfield it is

 
use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB;
/**
 * @MongoDB\Document
 * @MongoDB\InheritanceType("SINGLE_COLLECTION")
 * @MongoDB\DiscriminatorField("type")
 */
class SuperUser
{
    // ...
}

and I got the following exception

 
[MongoException] zero-length keys are not allowed, did you use $ with double quotes?

which was hard to track down in the first place, as there is no useful stack trace showed. What was working for me was:

 
use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB;
/**
 * @MongoDB\Document
 * @MongoDB\InheritanceType("SINGLE_COLLECTION")
 * @MongoDB\DiscriminatorField(fieldName="type")
 */
class SuperUser
{
    // ...
}


 Comments   
Comment by Jeremy Mikola [ 10/Apr/14 ]

This was actually changed in https://github.com/doctrine/mongodb-odm/commit/ebb7d5fe826f448fc4a53203c23bcc85e610b858. The documentation from that change is what is currently published, but the code is still sitting in the master branch since there's no 1.0.0-BETA10 tag yet.

Your work-around is valid, and will continue to work with 1.0.0-BETA10, since I've left BC support for the old annotation style. My apologies for the inconvenience.





[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-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-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:






Generated at Tue Sep 23 10:30:57 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.