Permalink
Browse files

Fixed ProxyReferenceRepository which was forcing to have a getId.

  • Loading branch information...
Guilherme Blanco
Guilherme Blanco committed Oct 10, 2013
1 parent b1e7d5a commit 8ffac1c63f34124f693b93889fa32f4036eb241b
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/Doctrine/Common/DataFixtures/ProxyReferenceRepository.php
@@ -28,6 +28,7 @@
* Allow data fixture references and identities to be persisted when cached data fixtures
* are pre-loaded, for example, by LiipFunctionalTestBundle\Test\WebTestCase loadFixtures().
*
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Anthon Pang <anthonp@nationalfibre.net>
*/
class ProxyReferenceRepository extends ReferenceRepository
@@ -59,12 +60,13 @@ protected function getRealClass($className)
*/
public function serialize()
{
$unitOfWork = $this->getManager()->getUnitOfWork();
$simpleReferences = array();
foreach ($this->getReferences() as $name => $reference) {
$className = $this->getRealClass(get_class($reference));
$simpleReferences[$name] = array($className, $reference->getId());
$simpleReferences[$name] = array($className, $this->getIdentifier($reference, $unitOfWork));
}
$serializedData = json_encode(array(
@@ -90,7 +92,7 @@ public function unserialize($serializedData)
$name,
$this->getManager()->getReference(
$proxyReference[0], // entity class name
$proxyReference[1] // id
$proxyReference[1] // identifiers
)
);
}

0 comments on commit 8ffac1c

Please sign in to comment.