inheritance

This commit is contained in:
2022-05-22 18:01:54 +02:00
parent 53a3f43d75
commit f6a101d5e7
18 changed files with 907 additions and 2 deletions

View File

@ -0,0 +1,26 @@
<?php
namespace App\DataFixtures;
use App\Entity\Employee1;
use App\Entity\Toothbrush1;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Persistence\ObjectManager;
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'));
$manager->persist($e1);
$e1 = new Employee1();
$e1->setJob('jefe')->setName('benganito')->setAge(30)->setToothbrush((new Toothbrush1())->setBrand('signal'));
$manager->persist($e1);
$manager->flush();
}
}
// symfony console doctrine:fixtures:load