src/Acl/Tenant/Loader/Acl.php
public function load(Tenant $tenant)
    {
        $data = (array) json_decode(json_encode($tenant->getData()));
        $objects = Objects::parseFile($this->path, $data);
        $manager = $this->accessService->getManager();

        foreach ($objects as $object) {
            $access = $this->accessService->createInstance();
            $access
                ->setOwner($object->owner)
                ->setOwnerUuid($object->owner_uuid)
                ->setAssignee($object->assignee)
                ->setAssigneeUuid($object->assignee_uuid)
                ->setTenant($object->tenant);

            foreach ($object->permissions as $subObject) {
                $permission = $this->permissionService->createInstance();
                $permission
                    ->setScope($subObject->scope)
                    ->setEntity($subObject->entity)
                    ->setEntityUuid($subObject->entity_uuid)
                    ->setKey($subObject->key)
                    ->setAttributes($subObject->attributes)
                    ->setTenant($object->tenant);
                $access->addPermission($permission);
            }

            $manager->persist($access);
            $manager->flush();
            $manager->detach($access);

            foreach ($access->getPermissions() as $permission) {
                $manager->detach($permission);
            }
        }
    }
public function load(Tenant $tenant)
    {
        $data = (array) json_decode(json_encode($tenant->getData()));
        $objects = Objects::parseFile($this->path, $data);
        $manager = $this->accessService->getManager();

        foreach ($objects as $object) {
            $access = $this->accessService->createInstance();
            $access
                ->setOwner($object->owner)
                ->setOwnerUuid($object->owner_uuid)
                ->setAssignee($object->assignee)
                ->setAssigneeUuid($object->assignee_uuid)
                ->setTenant($object->tenant);

            foreach ($object->permissions as $subObject) {
                $permission = $this->permissionService->createInstance();
                $permission
                    ->setScope($subObject->scope)
                    ->setEntity($subObject->entity)
                    ->setEntityUuid($subObject->entity_uuid)
                    ->setKey($subObject->key)
                    ->setAttributes($subObject->attributes)
                    ->setTenant($object->tenant);
                $access->addPermission($permission);
            }

            $manager->persist($access);
            $manager->flush();
            $manager->detach($access);

            foreach ($access->getPermissions() as $permission) {
                $manager->detach($permission);
            }
        }
    }
public function load ( Tenant $ tenant ) { $ data = ( array ) json_decode ( json_encode ( $ tenant -> getData ( ) ) ) ; $ objects = Objects :: parseFile ( $ this -> path , $ data ) ; $ manager = $ this -> accessService -> getManager ( ) ; foreach ( $ objects as $ object ) { $ access = $ this -> accessService -> createInstance ( ) ; $ access -> setOwner ( $ object -> owner ) -> setOwnerUuid ( $ object -> owner_uuid ) -> setAssignee ( $ object -> assignee ) -> setAssigneeUuid ( $ object -> assignee_uuid ) -> setTenant ( $ object -> tenant ) ; foreach ( $ object -> permissions as $ subObject ) { $ permission = $ this -> permissionService -> createInstance ( ) ; $ permission -> setScope ( $ subObject -> scope ) -> setEntity ( $ subObject -> entity ) -> setEntityUuid ( $ subObject -> entity_uuid ) -> setKey ( $ subObject -> key ) -> setAttributes ( $ subObject -> attributes ) -> setTenant ( $ object -> tenant ) ; $ access -> addPermission ( $ permission ) ; } $ manager -> persist ( $ access ) ; $ manager -> flush ( ) ; $ manager -> detach ( $ access ) ; foreach ( $ access -> getPermissions ( ) as $ permission ) { $ manager -> detach ( $ permission ) ; } } }
{@inheritdoc}
{