public function getEntityAlias()
    {
        if (!$this->entityAlias) {
            $className       = $this->getEntityClassName();
            $reflectionCLass = new ReflectionClass($className);

            if (is_string($reflectionCLass->getConstant('ALIAS_NAME'))) {
                $this->entityAlias = $reflectionCLass->getConstant('ALIAS_NAME');
            } else {
                if (method_exists($this->getRepository(), 'getEntityAlias')) {
                    $this->entityAlias = $this->getRepository()->getEntityAlias();
                } else {
                    $this->entityAlias = end(explode('\\', $className));
                }
            }

            $this->entityAlias = str_replace('.', '', $this->entityAlias);
        }

        return $this->entityAlias;
    }