@param $entity

@return string
4098
public function defaultRender($entity)
    {
        $value = (string) $this->getPropertyValue($entity);
        return $this->safeHtml ? $value : htmlspecialchars($value);
    }
1282969
public function guessChoiceLabelFromClass($entity)
    {
        $metadata = $this->metadataFactory->getClassMetadata($entity)->getMetadata();
        foreach ($metadata[0]->fieldMappings as $fieldName => $field) {
            if ($field['type'] == 'string') {
                return $fieldName;
            }
        }
        //if no string field found, return id
        return 'id';
    }
68212
public function getEntityMetadata($entity)
    {
        if (!$this->isManagedByDoctrine($entity)) {
            return null;
        }

        $cacheKey = 'metadata';
        $entity   = $this->getEntityClassFull($entity);
        $metadata = $this->getFromCache($entity, $cacheKey);

        if (false !== $metadata) {
            return $metadata;
        }

        $metadata = $this->entityManager->getClassMetadata($entity);
        $this->cache[$metadata->getName()][$cacheKey] = $metadata;

        return $metadata;
    }
1081892
private function getEntityEncryptionReflectionProperties($entity)
    {
        return DoctrineHelper::getPropertiesByAnnotation($this->getClassName($entity), Encryption::class, $this->getReader());
    }
195469
private function getEncryptionMode($entity)
    {
        $className = ClassUtils::getClass($entity);
        $classMetadata = $this->metadataFactory->getMetadataFor($className);

        return $classMetadata->encryptionMode;
    }
1116027
public function transform($entity)
    {
        if (null === $entity) {
            return '';
        }
        if (!is_subclass_of($entity, $this->entityClass)) {
            throw new \InvalidArgumentException(sprintf(
                'Unsupported entity "%s" into "%s" loader.',
                get_class($entity),
                __CLASS__
            ));
        }

        return $entity->getId();
    }
965895
public function serialize($entity)
    {
        return array($this->getName().'.'.$this->_target_parent_key => $entity->get($this->_target_parent_key));
    }
297965
private function getMetadata($entity)
    {
        try {
            $metadata = $this->em->getMetadataFactory()->getMetadataFor($entity);
        } catch (MappingException $e) {
            throw new \Exception('getMetadata(): Given object '.$entity.' is not a Doctrine Entity.');
        }

        return $metadata;
    }
535096
protected function getIdentifier($entity)
    {
        $entityId = json_decode($this->entityRegistry->getEntityId($entity), true);

        if (is_array($entityId)) {
            $identifier = [];

            foreach ($entityId as $key => $value) {
                $key              = strtolower(Normalise::toUnderscoreSeparated(Normalise::fromCamelCase($key)));
                $identifier[$key] = $value;
            }

            return $identifier;
        }

        $primary = $this->builder->getMeta(get_class($entity))->primary;

        return [$primary => $entityId];
    }
504252
private function getMapping($entity)
    {
        if (!array_key_exists($entity, $this->mappings)) {
            throw new \InvalidArgumentException("'$entity' is not a valid mapping key. One of [".implode(', ', array_keys($this->mappings)).'] is expected.');
        }

        return $this->mappings[$entity];
    }
992586
public function getOriginal($entity)
    {
        $hashId       = $this->getHashId($entity);
        $originalData = $this->originalData[$hashId];

        return $originalData;
    }
824220
private function getHeaders(Entity $entity)
    {
        yield 'ccm_date_created' => 'dateCreated';

        $attributes = $entity->getAttributes();
        foreach ($attributes as $attribute) {
            yield $attribute->getAttributeKeyHandle() => $attribute->getAttributeKeyDisplayName();
        }
    }
642349
protected function getEntityTable($entity)
    {
        if (!$entity instanceof EntityInterface) {
            $entity = $this->getEntityClass($entity);
        }
        return $this->tablePrefix . $entity::getTable() . $this->tableSuffix;
    }
726217
public function returnId($entity = null)
	{
	    if (substr ($entity, 0, 1) == "/") {
	        $entityID = $this->pathId($entity);
	    } else {
	        $entityID = $this->titleId($entity);
	    }

	    return $entityID;
	}
1003907
public function getValidatorFor($entity)
    {
        $rules = $this->getEntityRulesFor($entity);

        return $this->validator->make($this->extract($entity), $rules->rules($entity), $rules->messages());
    }
132627
public function article($entity)
    {
        if (!$entity->displayArticleMetaTags) {
            return '';
        }

        $attributes = [
            'article:publisher' => Configure::read('Settings.Cms.SEO.Social.facebook_url'),
            'article:tag' => '',
            'article:section' => ''
        ];

        if ($entity->displayMetaDates) {
            $attributes['article:published_time'] = ($entity->published !== null) ? $entity->published->format('c') : null;
            $attributes['article:modified_time'] = $entity->modified->format('c');
        }

        $out = '';
        foreach ($attributes as $property => $content) {
            $out .= $this->_render(self::ATTR_PROP, $property, $content);
        }

        return $out;
    }
983650
private function hashEntity($entity)
    {
        $class = ClassUtils::getClass($entity);

        $ids = $this->em->getClassMetadata($class)->getIdentifierValues($entity);

        return $class.spl_object_hash($entity).reset($ids);
    }