Returns is received entity managed by doctrine or not

@param object|string $entity Entity object or just entity name in the full or shot notation

@return bool
488948
public function isManagedByDoctrine($entity)
    {
        $cacheKey  = 'managed';
        $entity    = $this->toString($entity);
        $isManaged = $this->getFromCache($entity, $cacheKey, null);

        if (null !== $isManaged) {
            return $isManaged;
        }

        try {
            $this->managed = $isManaged = (bool) $this->entityManager->getReference($entity, 0);
            $entity = $this->getEntityClassFull($entity);
        } catch (\Exception $e) {
            $isManaged = false;
        }

        $this->cache[$entity][$cacheKey] = $isManaged;

        return $isManaged;
    }
61377
protected function _getTableEntity($entity = '') {
        /** @var $class \Gcs\Framework\Core\Orm\Entity\Entity */

        $entity = ucfirst(preg_replace_callback("/(?:^|_)([a-z])/", function ($matches) {
            return strtoupper($matches[1]);
        }, $entity));

        $className = '\Orm\Entity\\' . ucfirst($entity);

        if (class_exists($className)) {
            return self::Entity()->$entity();
        }
        else {
            throw new MissingEntityException('The Entity ' . $entity . ' does not exist');
        }
    }
1100160
protected function cartItemsCheck($entity)
    {
        return function ($item) use ($entity) {
            return $item->modelType == get_class($entity) &&
                $item->modelId == $entity->{$entity->getKeyName()}
            ;
        };
    }
949892
public function getEntity($entity = null)
    {
        if ($entity === null) {
            $class = $this->class;
            $entity = new $class();
        }

        if ($entity instanceof Content && !$entity->getContenttype() && $ct = $this->getClassMetadata()->getBoltName()) {
            $contentType = $this->metadata->createContentType($ct);
            if ($contentType) {
                $entity->setContenttype($contentType);
            } else {
                $entity->setContenttype($ct);
            }
        }

        return $entity;
    }
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;
  }
21756
public function delete($entity)
    {
        if ($this->manager->isTraversable($entity)) {
            return $this->deleteCollection($entity);
        } else {
            $this->deleteEntity($entity);
        }
    }
835748
private function updateEntity($entity)
    {
        $change = false;

        $propertyAccessor = PropertyAccess::createPropertyAccessor();
        $targetProperty = $propertyAccessor->getValue($entity, $this->targetProperty);

        // if entity state is still proxy, we try to load its entity to make sure that target property is correct
        if($entity instanceof Proxy && $targetProperty === null) {
            $this->loadEntity($entity);
            $targetProperty = $propertyAccessor->getValue($entity, $this->targetProperty);
        }

        if($targetProperty) {
            // update id property
            $idProperty = $propertyAccessor->getValue($entity, $this->idProperty);
            $id = $propertyAccessor->getValue($targetProperty, 'id');
            if($idProperty != $id) {
                $propertyAccessor->setValue($entity, $this->idProperty, $id);
                $change = true;
            }

            // update class property
            $classProperty = $propertyAccessor->getValue($entity, $this->classProperty);
            $class = $this->targetClassResolver->resolveClass($targetProperty);
            if($classProperty != $class) {
                $propertyAccessor->setValue($entity, $this->classProperty, $class);
                $change = true;
            }
        } else {
            if(null !== $propertyAccessor->getValue($entity, $this->idProperty)) {
                $propertyAccessor->setValue($entity, $this->idProperty, null);
                $change = true;
            }

            if(null !== $propertyAccessor->getValue($entity, $this->classProperty)) {
                $propertyAccessor->setValue($entity, $this->classProperty, null);
                $change = true;
            }
        }

        return $change;
    }
447124
public function getId(&$entity)
    {
        $structure = $this->getEntityStructure($entity);

        if (isset($entity->{$structure->primaryColumn->propertyName})) {
            return $entity->{$structure->primaryColumn->propertyName};
        }
        return null; // @codeCoverageIgnore
    }
642349
protected function getEntityTable($entity)
    {
        if (!$entity instanceof EntityInterface) {
            $entity = $this->getEntityClass($entity);
        }
        return $this->tablePrefix . $entity::getTable() . $this->tableSuffix;
    }
361923
public function incoming(Entity\Content $entity)
    {
        return $this->filter(function ($el) use ($entity) {
            /** @var Entity\Relations $el */
            return $el->getToContenttype() == (string) $entity->getContenttype() && $el->getToId() === $entity->getId();
        });
    }
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));
    }
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();
    }
364441
public function hasChanged($entity)
    {
        $hashId = $this->getHashId($entity);

        if (!isset($this->originalData[$hashId])) {
            throw new OrmException("Entity is not registered");
        }

        if (isset($this->comparators[get_class($entity)])) {
            return $this->hasChangedUsingComparisonFunction($entity);
        }

        return $this->hasChangedUsingReflection($entity);
    }
1200702
public function getEntityState($entity)
    {
        if (isset($this->_states[$entity])) {
            return $this->_states[$entity];
        }

        return AnDomain::STATE_CLEAN;
    }
783985
public function getDescriptorFor($entity)
    {
        return $this->descriptors->containsKey($entity)
            ? $this->descriptors->get($entity)
            : $this->createDescriptor($entity);
    }
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;
    }
466297
public function get($entity)
    {
        $key = $this->mapping['fieldname'];
        $valueMethod = 'get' . ucfirst($key);
        $value = $entity->$valueMethod();

        return $value;
    }