'social', 'role_scopes' => [ 'role_scope_CHILL_FOO_EDIT_social', 'role_scope_CHILL_FOO_SEE_administrative', 'role_scope_CHILL_FOO_EDIT_all', ], ], [ 'name' => 'administrative', 'role_scopes' => [ 'role_scope_CHILL_FOO_SEE_social', 'role_scope_CHILL_FOO_EDIT_administrative', 'role_scope_CHILL_FOO_EDIT_all', ], ], [ 'name' => 'direction', 'role_scopes' => [ 'role_scope_CHILL_FOO_EDIT_all', 'role_scope_CHILL_FOO_SEE_DETAILS_social', 'role_scope_CHILL_FOO_SEE_DETAILS_administrative', ], ], ]; public static $refs = []; public function getOrder() { return 400; } public function load(ObjectManager $manager) { foreach (static::$permissionGroup as $new) { $permissionGroup = new PermissionsGroup(); $permissionGroup->setName($new['name']); foreach ($new['role_scopes'] as $roleScopeRef) { $permissionGroup->addRoleScope($this->getReference($roleScopeRef)); } $manager->persist($permissionGroup); $reference = 'permission_group_' . $new['name']; echo "Creating {$reference} \n"; $this->setReference($reference, $permissionGroup); static::$refs[] = $reference; } $manager->flush(); } }