fixtures
This commit is contained in:
parent
86205bbdba
commit
1a6281855f
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue