Validator/Constraints/SharingValidator.php
private function validateIdentity(Sharing $constraint, $identityClass, array $roles, Collection $permissions): void
    {
        $res = $this->validateClass($constraint, $identityClass, $constraint->identityClass);

        if ($res && !$this->sharingManager->hasIdentityConfig($identityClass)) {
            $res = false;
            $this->context->buildViolation($constraint->classNotManagedMessage)
                ->atPath($constraint->identityClass)
                ->setParameter('%class_property%', $constraint->identityClass)
                ->setParameter('%class%', $identityClass)
                ->addViolation()
            ;
        }

        if ($res) {
            $config = $this->sharingManager->getIdentityConfig($identityClass);
            $this->validateRoles($constraint, $config, $roles);
            $this->validatePermissions($constraint, $config, $permissions);
        }
    }
private function validateIdentity(Sharing $constraint, $identityClass, array $roles, Collection $permissions): void
    {
        $res = $this->validateClass($constraint, $identityClass, $constraint->identityClass);

        if ($res && !$this->sharingManager->hasIdentityConfig($identityClass)) {
            $res = false;
            $this->context->buildViolation($constraint->classNotManagedMessage)
                ->atPath($constraint->identityClass)
                ->setParameter('%class_property%', $constraint->identityClass)
                ->setParameter('%class%', $identityClass)
                ->addViolation()
            ;
        }

        if ($res) {
            $config = $this->sharingManager->getIdentityConfig($identityClass);
            $this->validateRoles($constraint, $config, $roles);
            $this->validatePermissions($constraint, $config, $permissions);
        }
    }
private function validateIdentity ( Sharing $ constraint , $ identityClass , array $ roles , Collection $ permissions ) : void { $ res = $ this -> validateClass ( $ constraint , $ identityClass , $ constraint -> identityClass ) ; if ( $ res && ! $ this -> sharingManager -> hasIdentityConfig ( $ identityClass ) ) { $ res = false ; $ this -> context -> buildViolation ( $ constraint -> classNotManagedMessage ) -> atPath ( $ constraint -> identityClass ) -> setParameter ( '%class_property%' , $ constraint -> identityClass ) -> setParameter ( '%class%' , $ identityClass ) -> addViolation ( ) ; } if ( $ res ) { $ config = $ this -> sharingManager -> getIdentityConfig ( $ identityClass ) ; $ this -> validateRoles ( $ constraint , $ config , $ roles ) ; $ this -> validatePermissions ( $ constraint , $ config , $ permissions ) ; } }
Validate the identity.

@param Sharing    $constraint    The sharing constraint
@param string     $identityClass The identity class
@param string[]   $roles         The roles
@param Collection $permissions   The permissions
Validate the identity .