Browse Source

Fix bug on load data

Jérémie Libeau 7 years ago
parent
commit
98a796c6b9
2 changed files with 4 additions and 4 deletions
  1. 1 1
      src/AppBundle/Entity/ReferenceManger.php
  2. 3 3
      src/AppBundle/Entity/References.php

+ 1 - 1
src/AppBundle/Entity/ReferenceManger.php

@@ -71,7 +71,7 @@ class ReferenceManger extends EntityRepository
         $data = file_get_contents($filename);
         /** @var References $references */
         $references = $this->serializer->deserialize($data, 'AppBundle\\Entity\\References', 'yaml');
-        foreach ($references->getReferences() as $reference) {
+        foreach ($references->references as $reference) {
             $this->_em->persist($reference);
         }
         $this->_em->flush();

+ 3 - 3
src/AppBundle/Entity/References.php

@@ -18,10 +18,10 @@ class References
 
     /**
      * References constructor.
-     * @param \AppBundle\Entity\Reference[] $references
+     * @param \AppBundle\Entity\Reference[] $ref
      */
-    public function __construct(array $references)
+    public function __construct($ref = [])
     {
-        $this->references = $references;
+        $this->references = $ref;
     }
 }