mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-05 14:25:00 +00:00
Pass class as second parameter to getReference() fixture method
This commit is contained in:
@@ -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);
|
||||
|
@@ -13,7 +13,9 @@ namespace Chill\EventBundle\DataFixtures\ORM;
|
||||
|
||||
use Chill\MainBundle\DataFixtures\ORM\LoadPermissionsGroup;
|
||||
use Chill\MainBundle\DataFixtures\ORM\LoadScopes;
|
||||
use Chill\MainBundle\Entity\PermissionsGroup;
|
||||
use Chill\MainBundle\Entity\RoleScope;
|
||||
use Chill\MainBundle\Entity\Scope;
|
||||
use Doctrine\Common\DataFixtures\AbstractFixture;
|
||||
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
@@ -31,10 +33,10 @@ class LoadRolesACL extends AbstractFixture implements OrderedFixtureInterface
|
||||
public function load(ObjectManager $manager): void
|
||||
{
|
||||
foreach (LoadPermissionsGroup::$refs as $permissionsGroupRef) {
|
||||
$permissionsGroup = $this->getReference($permissionsGroupRef, null);
|
||||
$permissionsGroup = $this->getReference($permissionsGroupRef, PermissionsGroup::class);
|
||||
|
||||
foreach (LoadScopes::$references as $scopeRef) {
|
||||
$scope = $this->getReference($scopeRef, null);
|
||||
$scope = $this->getReference($scopeRef, Scope::class);
|
||||
// create permission group
|
||||
switch ($permissionsGroup->getName()) {
|
||||
case 'social':
|
||||
|
Reference in New Issue
Block a user