@param object $entity

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

        return true;
    }
972401
public function contains($entity)
    {
        return $this->unitOfWork->isScheduledForInsert($entity)
            || ($this->unitOfWork->isInIdentityMap($entity) && ! $this->unitOfWork->isScheduledForDelete($entity));
    }
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;
    }
730799
public function isSelected($entity)
    {
        if (is_array($this->value) && in_array($entity, $this->value)) {
            return true;
        } else if ($this->value === $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 );
    }
1153357
public function getEntityClassFull($entity)
    {
        $entity = $this->toString($entity);

        if (isset($this->cache[$entity])) {
            return $entity;
        }

        if ($this->managed || $this->isManagedByDoctrine($entity)) {
            /** @var \Doctrine\Common\Persistence\Mapping\ClassMetadata $classMetaData */
            $classMetaData        = $this->entityManager->getClassMetadata($entity);
            $entity               = $classMetaData->getName();
            $this->cache[$entity] = ['metadata' => $classMetaData];
            $this->managed        = false;
        } else {
            $this->cache[$entity] = [];
        }

        return $entity;
    }
1074759
public function save($entity)
    {
        if ($this->idProperty->getValue($entity) === null) {
            return $this->insert($entity);
        } else {
            return $this->update($entity);
        }

    }
536796
public function getLevel($entity)
    {
        $primaryKey = $this->_getPrimaryKey();
        $id = $entity;
        if ($entity instanceof EntityInterface) {
            $id = $entity->get($primaryKey);
        }
        $config = $this->getConfig();
        $entity = $this->_table->find('all')
            ->select([$config['left'], $config['right']])
            ->where([$primaryKey => $id])
            ->first();

        if ($entity === null) {
            return false;
        }

        $query = $this->_table->find('all')->where([
            $config['left'] . ' <' => $entity[$config['left']],
            $config['right'] . ' >' => $entity[$config['right']],
        ]);

        return $this->_scope($query)->count();
    }
891495
public function save($entity)
    {
        $query = new Query($entity, false);
        $structure = $this->getEntityStructure($entity);

        if ($entity->_saved) {
            // Update
            $result = $query->update()->set($this->getEntityDataArray($entity))->where(array($structure->primaryColumn->name => $entity->_id))->apply();

            // Update relations
            RelationManager::with($entity)->saveRelations();

            return $result;
        } else {
            // Insert
            $id = $query->insert()->into($structure->tableName)->values($this->getEntityDataArray($entity))->apply();

            if ($id === false) {
                return false; // @codeCoverageIgnore
            }

            // Update relations
            RelationManager::with($entity)->saveRelations();

            // Save ID and state
            $entity->{$structure->primaryColumn->propertyName} = $id;
            $entity->_id = $id;
            $entity->_saved = true;

            return true;
        }
    }
1092237
public function eql($entity)
    {
        if ($entity instanceof AnDomainEntityProxy) {
            $object = $entity->getObject();
        } elseif ($entity instanceof AnMixinAbstract) {
            $object = $entity->getMixer();
        } else {
            $object = $entity;
        }

        return $this === $object;
    }
1032485
protected function checkEntityType(Entity $entity)
    {
        $entityClass = $this->mapper->getEntityClass($this->getTable());
        if (!($entity instanceof $entityClass)) {
            throw new InvalidArgumentException(
                'Repository ' . get_called_class() . ' can only handle ' . $entityClass . ' entites. Use different repository to handle ' . get_class(
                    $entity
                ) . '.'
            );
        }
    }
891851
public function refresh ($entity)
    {
        // Return if not saved and not in database.
        if (! $entity->_saved) return false;
        $structure = $this->getEntityStructure($entity);

        // ID Data.
        $idColumn = $structure->primaryColumn->name;
        $idValue = $entity->_id;

        if ($structure->primaryColumn->type === 'integer')
            $idValue = intval($idValue);

        // Clear Relationship Cache.
        $entity::clearCache();

        // Query for refreshing.
        $query = new Query($entity);
        $newEntity = $query->select()
            ->where($idColumn, $idValue)
            ->one();

        // If no entity is found (when refreshing).
        if (! $newEntity) return false;

        // Map to the old instance
        foreach ($structure->columns as $column) {
            $entity->{$column->propertyName} = $newEntity->{$column->propertyName};
        }

        return true;
    }
731644
protected function assertInstance($entity)
    {
        $entityClass = $this->definition->entity();
        if (!$entity instanceof $entityClass) {
            throw new RelationException(sprintf('Relation entity must be instance of %s, got %s', $entityClass, $this->getType($entity)));
        }

        return true;
    }
972118
public function isValidEntity($entity) {
    if ($entity->getEntityTypeId() === 'mentions') {
      return TRUE;
    }

    // Special cases for comments and posts.
    $allowed_content_types = [
      'comment',
    ];
    if (in_array($entity->getEntityTypeId(), $allowed_content_types)) {
      $mentions = $this->getMentionsFromRelatedEntity($entity);
      if (!empty($mentions)) {
        return TRUE;
      }
    }
    return FALSE;
  }
805351
public function isInIdentityMap($entity)
    {
        $oid = spl_object_hash($entity);

        if ( ! isset($this->entityIdentifiers[$oid])) {
            return false;
        }

        $classMetadata = $this->em->getClassMetadata(get_class($entity));
        $idHash        = implode(' ', $this->entityIdentifiers[$oid]);

        if ($idHash === '') {
            return false;
        }

        return isset($this->identityMap[$classMetadata->rootEntityName][$idHash]);
    }
66298
public function getValueByEntity($entity)
    {
        if (is_object($entity)) {
            $entity = get_class($entity);
        }

        /** @var ValueProviderInterface $provider */
        foreach ($this->getValues() as $provider) {
            if ($entity === $provider->getEntity()) {
                return $provider;
            }
        }

        return false;
    }
38093
public function flush($entity = null)
    {
        if ($entity !== null) {
            $this->persist($entity);
        }

        return $this->getEntityManager()->flush();
    }