This commit is contained in:
lubiana 2025-06-29 19:26:29 +02:00
parent bbc56a9af7
commit 1f9562d36b
Signed by: lubiana
SSH key fingerprint: SHA256:vW1EA0fRR3Fw+dD/sM0K+x3Il2gSry6YRYHqOeQwrfk
13 changed files with 525 additions and 507 deletions

View file

@ -16,29 +16,6 @@ final class AppFixtures extends Fixture
{
private ObjectManager $manager;
#[Override]
public function load(ObjectManager $manager): void
{
$this->manager = $manager;
$vendorA = $this->createVendor('Vendor A');
$this->addMenuItemsToVendor($vendorA);
$vendorB = $this->createVendor('Vendor B');
$this->addMenuItemsToVendor($vendorB);
}
public function createVendor(string $name): FoodVendor
{
$vendorA = new FoodVendor;
$vendorA->setName($name);
$vendorA->setMenuLink('https://vendora.com');
$vendorA->setPhone('1234567890');
$this->manager->persist($vendorA);
$this->manager->flush();
return $vendorA;
}
public function addMenuItemsToVendor(FoodVendor $vendor): void
{
$menuItems = [];
@ -63,4 +40,27 @@ final class AppFixtures extends Fixture
$this->manager->persist($orderItem);
}
}
public function createVendor(string $name): FoodVendor
{
$vendorA = new FoodVendor;
$vendorA->setName($name);
$vendorA->setMenuLink('https://vendora.com');
$vendorA->setPhone('1234567890');
$this->manager->persist($vendorA);
$this->manager->flush();
return $vendorA;
}
#[Override]
public function load(ObjectManager $manager): void
{
$this->manager = $manager;
$vendorA = $this->createVendor('Vendor A');
$this->addMenuItemsToVendor($vendorA);
$vendorB = $this->createVendor('Vendor B');
$this->addMenuItemsToVendor($vendorB);
}
}