mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-29 19:13:49 +00:00
Add second parameter to add-, get-, hasReference() methods in fixture classes
This commit is contained in:
@@ -24,20 +24,20 @@ trait LoadAbstractNotificationsTrait
|
||||
return;
|
||||
|
||||
foreach ($this->notifs as $notif) {
|
||||
$entityId = $this->getReference($notif['entityRef'])->getId();
|
||||
$entityId = $this->getReference($notif['entityRef'], null)->getId();
|
||||
|
||||
echo 'Adding notification for '.$notif['entityClass'].'(entity id:'.$entityId.")\n";
|
||||
|
||||
$newNotif = (new Notification())
|
||||
->setMessage($notif['message'])
|
||||
->setSender($this->getReference($notif['sender']))
|
||||
->setSender($this->getReference($notif['sender'], null))
|
||||
->setRelatedEntityClass($notif['entityClass'])
|
||||
->setRelatedEntityId($entityId)
|
||||
->setDate(new \DateTimeImmutable('now'))
|
||||
->setRead([]);
|
||||
|
||||
foreach ($notif['addressees'] as $addressee) {
|
||||
$newNotif->addAddressee($this->getReference($addressee));
|
||||
$newNotif->addAddressee($this->getReference($addressee, null));
|
||||
}
|
||||
|
||||
$manager->persist($newNotif);
|
||||
|
@@ -69,7 +69,8 @@ class LoadAddressReferences extends AbstractFixture implements ContainerAwareInt
|
||||
$ar->setStreetNumber((string) random_int(0, 199));
|
||||
$ar->setPoint($this->getRandomPoint());
|
||||
$ar->setPostcode($this->getReference(
|
||||
LoadPostalCodes::$refs[array_rand(LoadPostalCodes::$refs)]
|
||||
LoadPostalCodes::$refs[array_rand(LoadPostalCodes::$refs)],
|
||||
null
|
||||
));
|
||||
|
||||
$ar->setMunicipalityCode($ar->getPostcode()->getCode());
|
||||
|
@@ -30,8 +30,8 @@ class LoadGroupCenters extends AbstractFixture implements OrderedFixtureInterfac
|
||||
foreach (LoadCenters::$refs as $centerRef) {
|
||||
foreach (LoadPermissionsGroup::$refs as $permissionGroupRef) {
|
||||
$GroupCenter = new GroupCenter();
|
||||
$GroupCenter->setCenter($this->getReference($centerRef));
|
||||
$GroupCenter->setPermissionsGroup($this->getReference($permissionGroupRef));
|
||||
$GroupCenter->setCenter($this->getReference($centerRef, null));
|
||||
$GroupCenter->setPermissionsGroup($this->getReference($permissionGroupRef, null));
|
||||
|
||||
$manager->persist($GroupCenter);
|
||||
|
||||
|
@@ -59,7 +59,7 @@ class LoadPermissionsGroup extends AbstractFixture implements OrderedFixtureInte
|
||||
$permissionGroup->setName($new['name']);
|
||||
|
||||
foreach ($new['role_scopes'] as $roleScopeRef) {
|
||||
$permissionGroup->addRoleScope($this->getReference($roleScopeRef));
|
||||
$permissionGroup->addRoleScope($this->getReference($roleScopeRef, null));
|
||||
}
|
||||
|
||||
$manager->persist($permissionGroup);
|
||||
|
@@ -365,7 +365,7 @@ class LoadPostalCodes extends AbstractFixture implements OrderedFixtureInterface
|
||||
$manager->persist($c);
|
||||
$ref = 'postal_code_'.$code[0];
|
||||
|
||||
if (!$this->hasReference($ref)) {
|
||||
if (!$this->hasReference($ref, null)) {
|
||||
$this->addReference($ref, $c);
|
||||
self::$refs[] = $ref;
|
||||
}
|
||||
|
@@ -55,8 +55,8 @@ class LoadRoleScopes extends AbstractFixture implements OrderedFixtureInterface
|
||||
foreach (LoadScopes::$references as $scopeReference) {
|
||||
$roleScope = new RoleScope();
|
||||
$roleScope->setRole($key)
|
||||
->setScope($this->getReference($scopeReference));
|
||||
$reference = 'role_scope_'.$key.'_'.$this->getReference($scopeReference)->getName()['en'];
|
||||
->setScope($this->getReference($scopeReference, null));
|
||||
$reference = 'role_scope_'.$key.'_'.$this->getReference($scopeReference, null)->getName()['en'];
|
||||
echo "Creating {$reference} \n";
|
||||
$this->addReference($reference, $roleScope);
|
||||
$manager->persist($roleScope);
|
||||
|
@@ -80,7 +80,7 @@ class LoadUsers extends AbstractFixture implements ContainerAwareInterface, Orde
|
||||
->setEmail(sprintf('%s@chill.social', \str_replace(' ', '', (string) $username)));
|
||||
|
||||
foreach ($params['groupCenterRefs'] as $groupCenterRef) {
|
||||
$user->addGroupCenter($this->getReference($groupCenterRef));
|
||||
$user->addGroupCenter($this->getReference($groupCenterRef, null));
|
||||
}
|
||||
|
||||
echo 'Creating user '.$username."... \n";
|
||||
|
Reference in New Issue
Block a user