Pass class as second parameter to getReference() fixture method

This commit is contained in:
2024-11-28 13:28:52 +01:00
parent 19e6ceba28
commit f820273dd7
27 changed files with 94 additions and 59 deletions

View File

@@ -12,9 +12,11 @@ declare(strict_types=1);
namespace Chill\EventBundle\DataFixtures\ORM;
use Chill\EventBundle\Entity\Event;
use Chill\EventBundle\Entity\EventType;
use Chill\EventBundle\Entity\Participation;
use Chill\MainBundle\DataFixtures\ORM\LoadScopes;
use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Entity\Scope;
use Chill\PersonBundle\Entity\Person;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
@@ -44,12 +46,12 @@ class LoadParticipation extends AbstractFixture implements OrderedFixtureInterfa
$event = (new Event())
->setDate($this->faker->dateTimeBetween('-2 years', '+6 months'))
->setName($this->faker->words(random_int(2, 4), true))
->setType($this->getReference(LoadEventTypes::$refs[array_rand(LoadEventTypes::$refs)], null))
->setType($this->getReference(LoadEventTypes::$refs[array_rand(LoadEventTypes::$refs)], EventType::class))
->setCenter($center)
->setCircle(
$this->getReference(
LoadScopes::$references[array_rand(LoadScopes::$references)],
null
Scope::class
)
);
$manager->persist($event);