24 lines
475 B
PHP
24 lines
475 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\DataFixtures;
|
||
|
|
||
|
use App\Entity\Entity1;
|
||
|
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||
|
use Doctrine\Persistence\ObjectManager;
|
||
|
|
||
|
class AppFixtures extends Fixture
|
||
|
{
|
||
|
public function load(ObjectManager $manager): void
|
||
|
{
|
||
|
for ($i = 0; $i < 20; $i++) {
|
||
|
$e = new Entity1();
|
||
|
$e->setName('entity '.$i);
|
||
|
$manager->persist($e);
|
||
|
}
|
||
|
|
||
|
$manager->flush();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// symfony console doctrine:fixtures:load
|