public function getEntityAlias($entity)
    {
        if (!($this->doctrine instanceof Registry)) {
            return null;
        }

        $class = get_class($entity);

        $namespaces = $this
            ->doctrine
            ->getManager()
            ->getConfiguration()
            ->getEntityNamespaces();

        foreach ($namespaces as $ns_alias => $ns) {
            if (strpos($class, $ns) === 0) {
                return $ns_alias.':'.ltrim(str_replace($ns, '', $class), '\\');
            }
        }

        return null;
    }
public function getEntityAlias($entity)
    {
        if (!($this->doctrine instanceof Registry)) {
            return null;
        }

        $class = get_class($entity);

        $namespaces = $this
            ->doctrine
            ->getManager()
            ->getConfiguration()
            ->getEntityNamespaces();

        foreach ($namespaces as $ns_alias => $ns) {
            if (strpos($class, $ns) === 0) {
                return $ns_alias.':'.ltrim(str_replace($ns, '', $class), '\\');
            }
        }

        return null;
    }
@param object $entity

@return string|null