From 1a6281855f8d5e61b22839f47a232e3ed65e8bea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20=C3=81lvarez?= Date: Sun, 22 May 2022 18:36:49 +0200 Subject: [PATCH] fixtures --- src/DataFixtures/InheritanceFixtures.php | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/DataFixtures/InheritanceFixtures.php b/src/DataFixtures/InheritanceFixtures.php index c85b10f..1d54a93 100644 --- a/src/DataFixtures/InheritanceFixtures.php +++ b/src/DataFixtures/InheritanceFixtures.php @@ -3,7 +3,11 @@ namespace App\DataFixtures; use App\Entity\Employee1; +use App\Entity\Employee2; +use App\Entity\Employee3; use App\Entity\Toothbrush1; +use App\Entity\Toothbrush2; +use App\Entity\Toothbrush3; use Doctrine\Bundle\FixturesBundle\Fixture; use Doctrine\Persistence\ObjectManager; @@ -12,13 +16,29 @@ class InheritanceFixtures extends Fixture public function load(ObjectManager $manager): void { $e1 = new Employee1(); - $e1->setJob('peon')->setName('pepito')->setAge(20)->setToothbrush((new Toothbrush1())->setBrand('colgate')); + $e1->setJob('peon1')->setName('pepito1')->setAge(20)->setToothbrush((new Toothbrush1())->setBrand('colgate1')); $manager->persist($e1); $e1 = new Employee1(); - $e1->setJob('jefe')->setName('benganito')->setAge(30)->setToothbrush((new Toothbrush1())->setBrand('signal')); + $e1->setJob('jefe1')->setName('benganito1')->setAge(30)->setToothbrush((new Toothbrush1())->setBrand('signal1')); $manager->persist($e1); + $e2 = new Employee2(); + $e2->setJob('peon2')->setName('pepito2')->setAge(20)->setToothbrush((new Toothbrush2())->setBrand('colgate2')); + $manager->persist($e2); + + $e2 = new Employee2(); + $e2->setJob('jefe2')->setName('benganito2')->setAge(30)->setToothbrush((new Toothbrush2())->setBrand('signal2')); + $manager->persist($e2); + + $e3 = new Employee3(); + $e3->setJob('peon3')->setName('pepito3')->setAge(20)->setToothbrush((new Toothbrush3())->setBrand('colgate3')); + $manager->persist($e3); + + $e3 = new Employee3(); + $e3->setJob('jefe3')->setName('benganito3')->setAge(30)->setToothbrush((new Toothbrush3())->setBrand('signal3')); + $manager->persist($e3); + $manager->flush(); } }