doctrine / data-fixtures

Doctrine2 ORM Data Fixtures Extensions
http://www.doctrine-project.org
MIT License
2.77k stars 224 forks source link

handle references for PHPCR ODM documents #241

Closed takeit closed 5 years ago

takeit commented 8 years ago

Doing:

$this->addReference('test', $document);

throws an exception:

[Symfony\Component\Debug\Exception\UndefinedMethodException]
  Attempted to call an undefined method named "getDocumentIdentifier" of class "Doctrine\ODM\PHPCR\UnitOfWork".

when using references with PHPCR ODM documents.

The PHPCR ODM UnitOfWork class doesn't have the method getDocumentIdentifier. There is getDocumentId instead. MongoDB ODM seems to use getDocumentIdentifier method in its UnitOfWork class but not in PHPCR.

Please, let me know if its enough.

mikeSimonson commented 8 years ago

@takeit Is this the only thing that prevent you to use the data-fixture with the ODM ?

takeit commented 8 years ago

@mikeSimonson I use it with PHPCR ODM in project I work on anyway. Even without the references that't not a blocker for me atm and it doesn't prevent me to use it.

mikeSimonson commented 8 years ago

@takeit Can you add a test for it ?

kojidev commented 5 years ago

@mikeSimonson This PR seems obsolete: https://github.com/doctrine/data-fixtures/blob/3a1e2c3c600e615a2dffe56d4ca0875cc5233e0a/lib/Doctrine/Common/DataFixtures/ReferenceRepository.php#L68

alcaeus commented 5 years ago

Thanks @kojiDev! This was indeed fixed in #255. Closing here.