@param mixed $entity
@param null  $context

@return bool

@throws \LogicException
@throws \ObjectivePHP\Validation\Exception\ValidationException
549004
public function validate($entity, $context = null) : bool
    {
        if (!$entity instanceof AuditEvent) {
            throw new \LogicException('The Entity to validate must be an instance of \Fei\Service\Audit\Entity\AuditEvent');
        }

        return parent::validate($entity, $context);
    }
1161965
private function isDoctrineEntity($entity)
    {
        if ($this->annotationReader->isOrm($entity) || $this->annotationReader->isOdm($entity)) {
            return true;
        }

        return false;
    }
769601
public function isPathValid(ExecutionContextInterface $context)
    {
        if ($this->getStorage() instanceof Storage && $this->getStorage()->isPathRequired() && !$this->getPath()) {
            $context->addViolationAt('path', 'Path is required to fill for current type of storage');
        }
    }
1224429
public function isSatisfiedBy(Entity $entity)
    {
        if (property_exists($entity, 'visible')) {
            return (bool)$entity->visible;
        }

        throw new InvalidArgumentException("Property 'visible' does not exist in class " . get_class($entity));
    }
85546
public function validate() {
		parent::validate();

		if ($this->getEntity() === null) {
			throw new ValidationException("'entity' can't be null", 'entity', $this);
		}
		if ($this->getEntityStates() === null) {
			throw new ValidationException("'entityStates' can't be null", 'entityStates', $this);
		}
		if ($this->getUrl() === null) {
			throw new ValidationException("'url' can't be null", 'url', $this);
		}
	}
358298
public function validate(EntityInterface $entity)
    {
        if (!$entity instanceof UserGroup) {
            throw new Exception(
                sprintf('The Entity to validate must be an instance of %s', Role::class)
            );
        }

        $this->validateName($entity->getName());
        $this->validateDefaultRole($entity->getDefaultRole());
        $errors = $this->getErrors();

        return empty($errors);
    }
172472
public function isImageValid(ExecutionContextInterface $context)
    {
        if ($this->isImage() && is_null($this->getFile())) {
            $context->addViolationAt('file', 'This value should not be blank.');
        }
    }
313830
public function supportsEntity(EntityInterface $entity): bool
    {
        foreach ($this->mappers as $mapper) {
            if ($mapper->supportsEntity($entity)) {
                return true;
            }
        }

        return false;
    }
854538
public function isAttached( Base $entity )
    {
        return false !== array_search( $entity, $this->instancesPersisted, true ) ||
               false !== array_search( $entity, $this->instancesUnpersisted, true );
    }
193611
public static function validate($entity)
    {
        if (Kernel::VERSION_ID >= 40000) {
            $classFound = class_exists($entity, true);

            if (!$classFound) {
                throw new \InvalidArgumentException(sprintf('Entity "%s" was not found', $entity));
            }

            return $entity;
        }

        if (!preg_match('{^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*:[a-zA-Z0-9_\x7f-\xff\\\/]+$}', $entity)) {
            throw new \InvalidArgumentException(sprintf('The entity name isn\'t valid ("%s" given, expecting something like AcmeBlogBundle:Blog/Post)', $entity));
        }

        return $entity;
    }
975516
public function isNormalityEntity( &$entity = null )
    {
        if( $this->getEntity() === 'normality' ){
            $entity = $this->data['normality'];
            return true;
        }
        $entity = null;
        return false;
    }
314568
public function isCached( Base $entity, $source = self::PERSISTED )
    {
        switch( $source ) {
            case self::PERSISTED:
                return false !== array_search( $entity, $this->instancesPersisted, true );
            case self::UNPERSISTED:
                return false !== array_search( $entity, $this->instancesUnpersisted, true );
            case self::ALL:
                return $this->isCached( $entity, self::PERSISTED ) || $this->isCached( $entity, self::UNPERSISTED );
        }
        throw new \InvalidArgumentException("Bad source `{$source}` passed to " . __FUNCTION__);
    }
267941
public function validate($entity, $entityName = null)
    {
        $entityName = $entityName ?: 'root';

        // Validate root type
        $this->validateType($entity, $this->schema, $entityName);

        return $this;
    }
1045809
public function isValid($value, $context = null)
    {
        if (! $this->useContext) {
            $context = (array) $value;
        }

        $cleanedValue = $this->cleanSearchValue($value);
        $match        = $this->objectRepository->findOneBy($cleanedValue);

        if (! is_object($match)) {
            return true;
        }

        $expectedIdentifiers = $this->getExpectedIdentifiers($context);
        $foundIdentifiers    = $this->getFoundIdentifiers($match);

        if (count(array_diff_assoc($expectedIdentifiers, $foundIdentifiers)) == 0) {
            return true;
        }

        $this->error(self::ERROR_OBJECT_NOT_UNIQUE, $value);
        return false;
    }
1242719
public function getSingleIdentifierValue($entity)
    {
        $class = $this->em->getClassMetadata(get_class($entity));

        if ($class->isIdentifierComposite) {
            throw ORMInvalidArgumentException::invalidCompositeIdentifier();
        }

        $values = $this->isInIdentityMap($entity)
            ? $this->getEntityIdentifier($entity)
            : $class->getIdentifierValues($entity);

        return isset($values[$class->identifier[0]]) ? $values[$class->identifier[0]] : null;
    }
509091
public function create(Entity $entity)
    {
        if (!$entity->getValidator()->validate()) {
            throw new Exception\ValidatorException($entity->getValidator());
        }

        $values = $entity->getData();

        $reflection = $entity::getReflection();

        // Prevent to force empty primary property
        if ($reflection->hasPrimary()) {

            $primaryName = $reflection->getPrimaryProperty()->getName();

            if (empty($values[$primaryName])) {
                unset($values[$primaryName]);
            }
        }

        try {
            $primaryValue = $this->query()->insert($values)->run($this->connection);
        } catch (Exception\QueryException $e) {
            throw new Exception\RepositoryException($e->getMessage());
        }

        $this->_saveAssociated($primaryValue, $entity);

        return $primaryValue;
    }
171179
public function validate(EntityInterface $entity)
    {
        if (!$entity instanceof Notification) {
            throw new Exception('Entity to validate must be an instance of "Notification"');
        }

        $this->validateMessage($entity->getMessage());
        $this->validateLevel($entity->getLevel());
        $this->validateNamespace($entity->getNamespace());
        $this->validateOrigin($entity->getOrigin());
        $this->validateReportedAt($entity->getReportedAt());

        $errors = $this->getErrors();
        return empty($errors);
    }