return the normalize prefix of the eventname depending on classname.

@param Object $entity

@return string
183064
public function getEventNamePrefix($entity)
    {
        if (is_object($entity)) {
            $eventPrefix = strtolower(str_replace(NAMESPACE_SEPARATOR, '.', get_class($entity)).'.');
        } else {
            $eventPrefix = strtolower(str_replace(NAMESPACE_SEPARATOR, '.', $entity).'.');
        }
        if ($entity instanceof \Doctrine\ORM\Proxy\Proxy) {
            $prefix = str_replace(NAMESPACE_SEPARATOR, '.', $this->application->getEntityManager()->getConfiguration()->getProxyNamespace());
            $prefix .= '.'.$entity::MARKER.'.';

            $eventPrefix = str_replace(strtolower($prefix), '', $eventPrefix);
        }

        $eventPrefix = str_replace(array('backbee.', 'classcontent.'), array('', ''), $eventPrefix);

        return $eventPrefix;
    }
467947
public function serialize($entity)
    {
        return array($this->getName().'.'.$this->_parent_key => $entity->get($this->_parent_key));
    }
394171
protected function hasAnnotation($entity)
    {
        $reflection = $this->getReflectionClassFromObject($entity);

        return $this
            ->getAnnotationReader()
            ->getClassAnnotation($reflection, SubscribeDoctrineEvents::class);
    }
344826
public function defaultRender($entity)
    {
        $value = htmlspecialchars($this->getPropertyValue($entity));

        if ($this->truncate === false) {
            $truncatedValue = $value;
        } else {
            $truncatedValue = substr($value, 0, intval($this->truncate));
            if (strlen($truncatedValue) < strlen($value)) {
                $truncatedValue .= '...';
            }
        }

        return '<a title="' . $value . '" href="' . $value . '" target="' . $this->target . '">' . $truncatedValue . '</a>';
    }
300300
private function getLoader($entity)
    {
        $entityClass = get_class($entity);

        if ($this->unsupportedClasses->containsKey($entityClass)) {
            return;
        }
        if ($this->loaders->containsKey($entityClass)) {
            return $this->loaders->get($entityClass);
        }
        foreach ($this->loaders as $handledClass => $loader) {
            if (is_a($entity, $handledClass)) {
                $this->loaders->set($entityClass, $loader);

                return $loader;
            }
        }

        $this->unsupportedClasses->set($entityClass, false);
    }
1316052
public function transform($entity)
    {
        if (null === $entity || '' === $entity) {
            return null;
        }

        if (!is_object($entity)) {
            throw new UnexpectedTypeException($entity, 'object');
        }

        //Here, do not put the result in the cache because we must check the value in
        //reverseTransform (by QueryBuilder)

        return $this->accessor->getValue($entity, $this->identifier);
    }
1146601
public function getRoutePrefix($entity)
    {
        $prefix = strtolower(str_replace(array('\\', '/'), '_', $entity));

        if ($prefix && '/' === $prefix[0]) {
            $prefix = substr($prefix, 1);
        }

        return str_replace('/', '_', $prefix);
    }
946338
public function getEventClassName(string $event)
    {
        if (isset(self::$eventsMap[$event])) {
            return self::$eventsMap[$event];
        }

        $listeners = $this->eventDispatcher->getListeners($event);
        if (empty($listeners)) {
            return null;
        }

        foreach ($listeners as $listener) {
            if (!\is_array($listener) || 2 !== \count($listener)) {
                continue;
            }

            $reflectionMethod = new \ReflectionMethod($listener[0], $listener[1]);
            $args = $reflectionMethod->getParameters();
            if (!$args) {
                continue;
            }

            if (null !== $type = $args[0]->getType()) {
                return (string) $type;
            }
        }

        return null;
    }
965895
public function serialize($entity)
    {
        return array($this->getName().'.'.$this->_target_parent_key => $entity->get($this->_target_parent_key));
    }
1120881
private function getRelatedEntityIdentifier($entity)
    {
        \assert('is_object($entity)');

        if ($entity instanceof \Doctrine\Common\Persistence\Proxy) {
            $entity->__load();
        }

        $relClass = \get_class($entity);

        $ManagerForClass = $this->registry->getManagerForClass($relClass);

        if (!$ManagerForClass) {
            throw new \InvalidArgumentException(sprintf('The getManagerForClass for entity of class "%s" was empty.', $relClass));
        }

        $relId = $ManagerForClass->getMetadataFactory()
            ->getMetadataFor($relClass)->getIdentifierValues($entity);

        asort($relId);

        if (!$relId) {
            throw new \InvalidArgumentException(sprintf('The identifier for entity of class "%s" was empty.', $relClass));
        }

        return [$relClass, json_encode($relId)];
    }
579717
private function formatEventName($event_name, $entity)
    {
        if (is_object($entity)) {
            $event_name = strtolower(str_replace(NAMESPACE_SEPARATOR, '.', get_class($entity)).'.'.$event_name);

            if ($entity instanceof \Doctrine\ORM\Proxy\Proxy) {
                $prefix = str_replace(
                    NAMESPACE_SEPARATOR,
                    '.',
                    $this->application->getEntityManager()->getConfiguration()->getProxyNamespace()
                );
                $prefix .= '.'.$entity::MARKER.'.';

                $event_name = str_replace(strtolower($prefix), '', $event_name);
            }
        } else {
            $event_name = strtolower(str_replace(NAMESPACE_SEPARATOR, '.', $entity).'.'.$event_name);
        }

        $event_name = str_replace(array('backbee.', 'classcontent.'), array('', ''), $event_name);

        return $event_name;
    }
1241525
protected function getEntityKey($entity)
    {
        $keyName = Manager::getMapper($entity)->getEntityMap()->getKeyName();

        $wrapper = $this->factory->make($entity);

        return $wrapper->getEntityAttribute($keyName);
    }
105747
protected function getEntityHash(Mappable $entity)
    {
        $class = get_class($entity);

        $keyName = Mapper::getMapper($class)->getEntityMap()->getKeyName();

        return $class.'.'.$entity->getEntityAttribute($keyName);
    }
311268
private function getUserInputEntity($entity)
    {
        // Get rid of any special chars introduced.
        $entity = $this->makeSQLUnsafe($entity);

        // Only replace first occurrence.
        return preg_replace('/' . $this->getParams()['DBPREFIX'] . '/', '', $entity, 1);
    }
539325
public function setRecurrenceEventId($entity = null): string
    {
        $start = $entity instanceof EntityInterface ? $entity->get('start_date') : $entity['start_date'];
        $end = $entity instanceof EntityInterface ? $entity->get('end_date') : $entity['end_date'];
        $id = $entity instanceof EntityInterface ? $entity->get('id') : $entity['id'];

        $result = sprintf("%s__%s_%s", $id, strtotime($start), strtotime($end));

        return $result;
    }
1127915
protected function getEntityName($entityClassName)
    {
        preg_match_all('/\\\([a-zA-Z]+)/', $entityClassName, $matches);
        if (!empty($matches[1])) {
            return $matches[1][count($matches[1]) - 1];
        }
        return $entityClassName;
    }
1345472
protected function parseToDocument($entity)
    {
        $schemaMapper = $this->getSchemaMapper();
        $parsedDocument = $schemaMapper->map($entity);

        if (is_object($entity)) {
            foreach ($parsedDocument as $field => $value) {
                $entity->$field = $value;
            }
        }

        return $parsedDocument;
    }