withObjects() public method

public withObjects ( ObjectBag $objects ) : self
$objects Nelmio\Alice\ObjectBag
return self
Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  *
  * @throws InstantiationException
  */
 public function instantiate(FixtureInterface $fixture, ResolvedFixtureSet $fixtureSet, GenerationContext $context) : ResolvedFixtureSet
 {
     try {
         $instance = $this->createInstance($fixture);
     } catch (InstantiationThrowable $throwable) {
         throw $throwable;
     } catch (\Throwable $throwable) {
         throw InstantiationExceptionFactory::create($fixture, 0, $throwable);
     }
     $objects = $fixtureSet->getObjects()->with(new SimpleObject($fixture->getId(), $instance));
     return $fixtureSet->withObjects($objects);
 }