You've already forked symfony-playground
first commit
This commit is contained in:
23
src/DataFixtures/AppFixtures.php
Normal file
23
src/DataFixtures/AppFixtures.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?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
|
Reference in New Issue
Block a user