Helper/EntityHelper.php
public function getEntityClassShort($entity)
    {
        $cacheKey = 'short';
        $entity   = $this->getEntityClassFull($entity);
        $short    = $this->getFromCache($entity, $cacheKey);

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

        foreach ($this->entityManager->getConfiguration()->getEntityNamespaces() as $short => $full) {
            if (false === strpos($entity, $full)) {
                continue;
            }

            $short .= ':'.ltrim(str_replace($full, '', $entity), '\\');
            $this->cache[$full][$cacheKey] = $short;

            return $short;
        }

        return $entity;
    }
public function getEntityClassShort($entity)
    {
        $cacheKey = 'short';
        $entity   = $this->getEntityClassFull($entity);
        $short    = $this->getFromCache($entity, $cacheKey);

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

        foreach ($this->entityManager->getConfiguration()->getEntityNamespaces() as $short => $full) {
            if (false === strpos($entity, $full)) {
                continue;
            }

            $short .= ':'.ltrim(str_replace($full, '', $entity), '\\');
            $this->cache[$full][$cacheKey] = $short;

            return $short;
        }

        return $entity;
    }
public function getEntityClassShort ( $ entity ) { $ cacheKey = 'short' ; $ entity = $ this -> getEntityClassFull ( $ entity ) ; $ short = $ this -> getFromCache ( $ entity , $ cacheKey ) ; if ( false !== $ short ) { return $ short ; } foreach ( $ this -> entityManager -> getConfiguration ( ) -> getEntityNamespaces ( ) as $ short => $ full ) { if ( false === strpos ( $ entity , $ full ) ) { continue ; } $ short .= ':' . ltrim ( str_replace ( $ full , '' , $ entity ) , '\\' ) ; $ this -> cache [ $ full ] [ $ cacheKey ] = $ short ; return $ short ; } return $ entity ; }
Returns short name of the received entity or class name.

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

@return string For example 'AcmeBundle:User'
Returns short name of the received entity or class name .