@param Entity $entity

@return bool
426945
public function isSatisfiedBy(Entity $entity)
    {
        if (property_exists($entity, 'active')) {
            return (bool)$entity->active;
        }

        throw new InvalidArgumentException("Property 'active' does not exist in class " . get_class($entity));
    }
123954
protected function updateEntity(Entity $entity)
    {
        $action = \Schema::hasTable($entity->getTable()) ? 'update' : 'create';

        $this->migrations[$action][$entity->getTable()]['cols'] = $this->buildTable($entity);

        if($action == 'create' && $entity->timestamps) $this->migrations[$action][$entity->getTable()]['cols'][] = '$table->timestamps();';
    }
617077
protected function prepareEntityForGet(AbstractEntity $entity): bool
    {
        if ($entity instanceof AbstractDocument) {
            $this->prepareDocumentForGet($entity);
        }
        return true;
    }
289344
public function save(Entity $entity) {
    $this->_em->persist($entity);
    $this->_em->flush();
    return $this;
  }
749466
public function deleteEntity(EntityInterface $entity)
    {
        $delete = $this->tableGateway->getSql()->delete();
        $delete->where->equalTo(
            $this->tableGateway->getPrimaryKey(), $entity->getIdentifier()
        );

        try {
            $this->tableGateway->deleteWith($delete);
        } catch (RuntimeException $e) {
            return false;
        }

        return true;
    }
437087
protected function isAbleToIndex($entity)
    {
        try {
            $metaInformation = $this->metaInformationFactory->loadInformation($entity);
        } catch (SolrMappingException $e) {
            return false;
        }

        return true;
    }
144108
public function remove(Entity $entity) {
    if (method_exists($entity,'remove')) {
      $entity->remove();
    }
    $this->_em->remove($entity);
    
    return $this;
  }
1273384
protected function _ifUploaded($entity, $field)
    {
        if (array_key_exists($field, $this->_uploads)) {
            $data = $this->_uploads[$field];

            if (!empty($data['tmp_name'])) {
                return true;
            }
        }
        return false;
    }
674219
public function decode(EntityInterface $entity) {
		$idField = $this->_primaryKey;
		$hashid = $entity->get($idField);
		if (!$hashid) {
			return false;
		}

		$field = $this->_config['field'];
		if (!$field) {
			return false;
		}

		$id = $this->decodeHashid($hashid);

		$entity->set($field, $id);
		$entity->setDirty($field, false);

		return true;
	}
76363
private function checkLoop(Entity $entity) {
		foreach($this->protectLoop as $loop) {
			if (EntityReflexion::getTable($loop) == EntityReflexion::getTable($entity) && $entity->getPrimary() == $loop->getPrimary()) {
				return true;
			}
		}
		return false;
	}
1172143
public function deleteObject($entity)
    {
        try {
            return (bool) $entity->delete();
        } catch (\Exception $ex) {
            Yii::$app->getErrorHandler()->logException($ex);

            return false;
        }
    }
131651
private function process($entity)
    {
        $entityClass = get_class($entity);

        if (false === ($entity instanceof HasOptionalFieldsEntityInterface)) {
            return false;
        }

        $reflectionClass = new \ReflectionClass($entityClass);
        foreach ($reflectionClass->getProperties() as $reflectionProperty) {
            /** @var Optional $propertyAnnotation */
            $propertyAnnotation = $this->getReader()->getPropertyAnnotation($reflectionProperty, Optional::class);
            if (null === $propertyAnnotation) {
                continue;
            }

            $default = $this->getDefault($reflectionProperty, $propertyAnnotation->default);
            $reflectionProperty->setAccessible(true);

            if (null === $reflectionProperty->getValue($entity)) {
                $reflectionProperty->setValue($entity, $default);
            }
        }

        return true;
    }
143281
public function isTracked(EntityManagerInterface $em, $entity)
    {
        $class       = get_class($entity);
        $annotations = $this->reader->getClassAnnotations($em->getClassMetadata($class)->getReflectionClass());

        foreach ($annotations as $annotation) {
            if ($annotation instanceof Tracked) {
                return true;
            }
        }

        return false;
    }
769093
public function isRegistered($entity)
    {
        try {
            $entityId = $this->getEntityId($entity);

            return
                ($this->getEntityState($entity) == EntityStates::REGISTERED)
                || isset($this->entities[$this->getClassName($entity)][$entityId]);
        } catch (OrmException $e) {
            return false;
        }
    }
604373
public function delete($entity)
    {
        $query = new Query($entity, false);
        $structure = $this->getEntityStructure($entity);

        if ($entity->_saved) {
            return $query->delete($structure->tableName)->where(array($structure->primaryColumn->name => $entity->_id))->apply();
        }
        return false;
    }
1204038
protected function loadEntityClass(Entity $entity)
    {
        $type    = $entity->getType();
        $content = $entity->getContent();
        $class   = $entity->getNamespacedName();

        if (class_exists($class) || interface_exists($class)) {
            return false;
        }

        $this->logger->info(sprintf('Loading class "%s"', $class));

        $tempname = tempnam(sys_get_temp_dir(), 'proto') . '.php';

        file_put_contents($tempname, $content);

        include($tempname);
        @unlink($tempname);

        if ($type === Entity::TYPE_EXTENSION) {

            $this->logger->info(sprintf('Registering extension "%s"', $class));

            $config   = $this->config;
            $registry = $config->getExtensionRegistry();

            $class::registerAllExtensions($registry);

            return true;
        }

        return false;
    }
1117043
public function validateEntity($entity)
    {
        $description = $entity->getEntityDescription();

        //if entity is persisted only look at the modified
        //properties
        if ($entity->isModified()) {
            $properties = array_intersect_key($description->getProperty(), AnConfig::unbox($entity->getModifiedData()));
        } else {
            $properties = $description->getProperty();
        }

        foreach ($properties as $property) {
            $value = $entity->get($property->getName());
            $entity->getValidator()->validateData($entity, $property, $value);
        }

        return $entity->getErrors()->count() === 0;
    }