How to load fixtures with dependencies?

public function load(ObjectManager $manager) : void
{
 $category = new InvoiceCategory('BonBonSlickCat');
 $vendor = new User('BonBonSlick');
 $manager->persist(new Invoice(10, $category, $vendor));
$manager->flush();
}

/**
 * {@inheritdoc}
*/
 public function getDependencies() : array
{
 return [
InvoiceCategoryFixtures::class,
];
 }


Will fail because we aren't persisten data from which the invoice depends, and ELS\and will esistiti, it will give you errors that already have such data, because we load them in dependency. As pravlno loading fixtures with dependencies?
June 5th 19 at 21:32
1 answer
June 5th 19 at 21:34
Solution

Find more questions by tags Symfony