Skip to content
This repository has been archived by the owner on Nov 17, 2020. It is now read-only.

Commit

Permalink
Inject item data into new fixture instance
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierstoval authored Jul 13, 2017
1 parent 57dd1bc commit cbbdb84
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions AbstractFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ private function fixtureObject($data)

// If the data are in an array, we instanciate a new object.
if (is_array($data)) {
$obj = $this->createNewInstance();
$obj = $this->createNewInstance($data);
foreach ($data as $field => $value) {

// If the value is a callable we execute it and inject the fixture object and the manager.
Expand Down Expand Up @@ -349,8 +349,12 @@ protected function clearEntityManagerOnFlush()
/**
* Creates a new instance of the class associated with the fixture.
* Very useful if you have constructor arguments to manage.
*
* @param array $data
*
* @return object
*/
protected function createNewInstance()
protected function createNewInstance($data)
{
return new $this->entityClass;
}
Expand Down

0 comments on commit cbbdb84

Please sign in to comment.