You've already forked symfony-playground
inheritance
This commit is contained in:
26
src/DataFixtures/InheritanceFixtures.php
Normal file
26
src/DataFixtures/InheritanceFixtures.php
Normal 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
|
Reference in New Issue
Block a user