Get Entity Class

@return string
542276
private function getEntityClass()
    {
        /** @var ClassMetadata $metaData */
        foreach ($this->getDoctrineManager()->getMetadataFactory()->getAllMetadata() as $metaData) {
            if ($metaData->getName() === Config::class) {
                continue;
            }

            $reflectionClass = new \ReflectionClass($metaData->getName());
            if (true === in_array(Config::class, $this->getParentClassNames($reflectionClass))) {
                return $metaData->getName();
            }
        }

        throw new \RuntimeException('Missing config entity!');
    }
397216
private function getEntityId($entity, $entityClass)
    {
        $ids = $this->em->getClassMetadata($entityClass)->getIdentifierValues($entity);

        return reset($ids);
    }
932332
public function getEntityTypeManager() {
    if (empty($this->entityTypeManager)) {
      $this->entityTypeManager = \Drupal::entityTypeManager();
    }
    return $this->entityTypeManager;
  }
1166431
private function generateClass(): EntityGenerator
    {
        $this->entityFile = (new PhpFile())
            ->addComment('This file is auto-generated.');

        $this->entityClass = $this->entityFile
            ->addNamespace($this->entityData['namespace'])
            ->addClass($this->entityData['class'])
            ->addComment($this->entityData['class'] . ' entity' . PHP_EOL)
            ->addComment('@package ' . $this->entityData['namespace']);

        return $this;
    }
336992
public function getEntityService()
    {
        if (null === $this->entityService) {
            $entityServiceClass = $this->getEntityServiceClass();
            if (!class_exists($entityServiceClass)) {
                throw new \RuntimeException("Classe $entityServiceClass inexistente!");
            }
            $this->entityService = new $entityServiceClass();
            $this->entityService->setServiceLocator($this->getServiceLocator());
        }

        return $this->entityService;
    }
151882
public function getEntityName()
    {
        if (is_null($this->entityName)) {
            $this->entityName = self::getEntityNameFromClassName($this->getEntityClass());
        }

        return $this->entityName;
    }
17143
private function classGet()
    {
        return isset( $this->class )
            ? $this->class
            : (
                  ( $firstElement = $this->firstElementGet() )
                ? ( $this->class = get_class( $firstElement ) )
                : null
              )
            ;
    }
363897
public function getEntity()
    {
        $entity = $this->entityManager->getRepository($this->className)->find($this->id);
        if (!$entity) {
            throw new Error('Entity not found for class `' . $this->className . '` and ID `' . $this->id . '`.');
        }

        return $entity;
    }
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;
    }
374201
protected function getListingService()
    {
        if (null == $this->listingService) {
            $this->listingService = new EntityListingService(
                $this->getEntityClassName()
            );
        }
        return $this->listingService;
    }
131631
public function getEntityClassName()
    {
        if (null == $this->entityClass) {
            $this->setEntityClass(get_class($this->getEntity()));
        }
        return $this->entityClass;
    }
236979
public function getEntityType()
    {

        // query whether or not the entity type with the passed code is available
        if (isset($this->entityTypes[$entityTypeCode = $this->getEntityTypeCode()])) {
            return $this->entityTypes[$entityTypeCode];
        }

        // throw a new exception
        throw new \Exception(
            $this->appendExceptionSuffix(
                sprintf('Requested entity type "%s" is not available', $entityTypeCode)
            )
        );
    }
290932
protected function getEntityName()
    {
        if ($this->entityName === null) {
            $name = $this->entityClass;

            if (false !== $pos = strrpos($name, '\\')) {
                $name = substr($name, $pos + 1);
            }
            $name = strtolower(preg_replace('/([^A-Z])([A-Z])/', "$1_$2", $name));
            $name = str_replace('-', '_', $name);
            $this->entityName = $name;
        }

        return $this->entityName;
    }
485110
public function get($entityId)
    {
        $key = $this->getEntityDescriptor()->className();
        $key .= '::'.$entityId;
        $entity = $this->getIdentityMap()->get($key, false);
        if ($entity === false) {
            $entity = $this->load($entityId);
        }
        return $entity;
    }
1323694
protected function _getEntityClassName($entity)
    {
        if (is_object($entity)) {
            $className = get_class($entity);
        } else {
            $className = $entity;
        }
        return $className;
    }
379429
public function getBuilderClass()
    {
        if (!empty($this->builderClassName)) {
            return $this->builderClassName;
        }

        return $this->getConfig('builder') ?: '\\think\\db\\builder\\' . ucfirst($this->getConfig('type'));
    }
1022971
public function get($entity)
    {
        $name = is_object($entity) ? get_class($entity) : $entity;
        if (!isset($this->_entities[$name])) {
            $this->_entities[$name] = new Descriptor(['entity' => $entity]);
        }
        return $this->_entities[$name];
    }