[ 'names' => [ 'fr' => 'voir foo', 'en' => 'see foo', 'nl' => 'zie foo', ], ], 'CHILL_FOO_SEE_DETAILS' => [ 'names' => [ 'fr' => 'voir foo avec détails', 'en' => 'see foo with details', 'nl' => 'zie foo in details', ], ], 'CHILL_FOO_EDIT' => [ 'names' => [ 'fr' => 'modifier foo', 'en' => 'edit foo', 'nl' => 'editie foo', ], ], ]; public static $references = []; public function getOrder() { return 300; } public function load(ObjectManager $manager) { foreach (static::$permissions as $key => $permission) { foreach (LoadScopes::$references as $scopeReference) { $roleScope = new RoleScope(); $roleScope->setRole($key) ->setScope($this->getReference($scopeReference)); $reference = 'role_scope_' . $key . '_' . $this->getReference($scopeReference)->getName()['en']; echo "Creating {$reference} \n"; $this->addReference($reference, $roleScope); $manager->persist($roleScope); static::$references[] = $reference; } } $manager->flush(); } }