Nelmio\Alice\FixtureBuilder\Denormalizer\Fixture\FixtureDenormalizerInterface::denormalize PHP Method

denormalize() public method

A more specific version of {@see \Nelmio\Alice\BuilderInterface} dedicated to fixtures.
public denormalize ( FixtureBag $builtFixtures, string $className, string $fixtureId, array $specs, FlagBag $flags ) : FixtureBag
$builtFixtures Nelmio\Alice\FixtureBag
$className string FQCN (no flags)
$fixtureId string
$specs array Contains the list of property calls, constructor specification and method calls
$flags Nelmio\Alice\Definition\FlagBag Flags inherited from the namespace.
return Nelmio\Alice\FixtureBag $builtFixtures with the new built fixtures.
    public function denormalize(FixtureBag $builtFixtures, string $className, string $fixtureId, array $specs, FlagBag $flags) : FixtureBag;

Usage Example

 /**
  * {@inheritdoc}
  *
  * @param array $data subset of PHP data coming from the parser (does not contains any parameters)
  *
  * @example
  *  $data = [
  *      'Nelmio\Alice\Entity\User' => [
  *          'user0' => [
  *              'username' => 'bob',
  *          ],
  *      ],
  *  ];
  *
  * @return FixtureBag
  */
 public function denormalize(array $data) : FixtureBag
 {
     $fixtures = new FixtureBag();
     foreach ($data as $fqcnWithFlags => $rawFixtureSet) {
         $flags = $this->flagParser->parse($fqcnWithFlags);
         $fqcn = $flags->getKey();
         foreach ($rawFixtureSet as $reference => $specs) {
             $fixtures = $this->fixtureDenormalizer->denormalize($fixtures, $fqcn, $reference, $specs, $flags);
         }
     }
     return $fixtures;
 }
All Usage Examples Of Nelmio\Alice\FixtureBuilder\Denormalizer\Fixture\FixtureDenormalizerInterface::denormalize
FixtureDenormalizerInterface