private function addObjectRights($classname, array $config, UserSecurityIdentity $securityIdentity, $labelField = '_label')
    {
        $rights = $this->getActionsOnResources($config);
        foreach ((array) $rights as $resource => $actions) {
            if ('all' === $resource) {
                $this->addClassAcl($classname, $securityIdentity, $actions);
                $this->writeln(sprintf('    - Setting [%s] on all %s', implode(', ', $actions), $classname), OutputInterface::VERBOSITY_DEBUG);
                continue;
            }

            $object = $this->em->getRepository($classname)->findOneBy([$labelField => $resource]);
            if (null === $object) {
                $object = $this->em->find($classname, $resource);
            }

            if (null === $object) {
                $this->writeln(sprintf('    - Unknown %s `%s`', $classname, $resource), OutputInterface::VERBOSITY_DEBUG);
                continue;
            }

            $this->addObjectAcl($object, $securityIdentity, $actions);
            $this->writeln(sprintf('    - Setting [%s] on all %s `%s`', implode(', ', $actions), $classname, $resource), OutputInterface::VERBOSITY_DEBUG);
        }
    }
private function addObjectRights($classname, array $config, UserSecurityIdentity $securityIdentity, $labelField = '_label')
    {
        $rights = $this->getActionsOnResources($config);
        foreach ((array) $rights as $resource => $actions) {
            if ('all' === $resource) {
                $this->addClassAcl($classname, $securityIdentity, $actions);
                $this->writeln(sprintf('    - Setting [%s] on all %s', implode(', ', $actions), $classname), OutputInterface::VERBOSITY_DEBUG);
                continue;
            }

            $object = $this->em->getRepository($classname)->findOneBy([$labelField => $resource]);
            if (null === $object) {
                $object = $this->em->find($classname, $resource);
            }

            if (null === $object) {
                $this->writeln(sprintf('    - Unknown %s `%s`', $classname, $resource), OutputInterface::VERBOSITY_DEBUG);
                continue;
            }

            $this->addObjectAcl($object, $securityIdentity, $actions);
            $this->writeln(sprintf('    - Setting [%s] on all %s `%s`', implode(', ', $actions), $classname, $resource), OutputInterface::VERBOSITY_DEBUG);
        }
    }
private function addObjectRights ( $ classname , array $ config , UserSecurityIdentity $ securityIdentity , $ labelField = '_label' ) { $ rights = $ this -> getActionsOnResources ( $ config ) ; foreach ( ( array ) $ rights as $ resource => $ actions ) { if ( 'all' === $ resource ) { $ this -> addClassAcl ( $ classname , $ securityIdentity , $ actions ) ; $ this -> writeln ( sprintf ( '    - Setting [%s] on all %s' , implode ( ', ' , $ actions ) , $ classname ) , OutputInterface :: VERBOSITY_DEBUG ) ; continue ; } $ object = $ this -> em -> getRepository ( $ classname ) -> findOneBy ( [ $ labelField => $ resource ] ) ; if ( null === $ object ) { $ object = $ this -> em -> find ( $ classname , $ resource ) ; } if ( null === $ object ) { $ this -> writeln ( sprintf ( '    - Unknown %s `%s`' , $ classname , $ resource ) , OutputInterface :: VERBOSITY_DEBUG ) ; continue ; } $ this -> addObjectAcl ( $ object , $ securityIdentity , $ actions ) ; $ this -> writeln ( sprintf ( '    - Setting [%s] on all %s `%s`' , implode ( ', ' , $ actions ) , $ classname , $ resource ) , OutputInterface :: VERBOSITY_DEBUG ) ; } }
Adding rights on generic objects.

@param string               $classname
@param array                $config
@param UserSecurityIdentity $securityIdentity
@param string               $labelField
Adding rights on generic objects .