27 lines
722 B
PHP
27 lines
722 B
PHP
|
<?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
|