@param string $entityClass
@param string $rel

@return mixed
437695
protected function loadResource(string $entityClass, string $rel)
    {
        $uri = $this->resource->getLinks()->getHref($rel);

        return $this->restClient->getResource($entityClass, $uri)->getEntity();
    }
388458
private function getRelationIri($rel): string
    {
        if (!(\is_array($rel) || \is_string($rel))) {
            throw new UnexpectedValueException('Expected relation to be an IRI or array');
        }

        return \is_string($rel) ? $rel : $rel['_links']['self']['href'];
    }
646839
public function createBatchDeleteForm($entityClass, array $entities = null)
    {
        if (null !== $entities && empty($entities)) {
            throw new FormException(
                sprintf('Unable to create batch delete form for entity class "%s": entity array is empty.', $entityClass)
            );
        }

        $options = [
            'entity_class' => $entityClass,
        ];

        if (!empty($entities)) {
            $options = array_merge($options, [
                'action'   => $this->adminRouter->generate(reset($entities), $entityClass, AdminRouter::TYPE_BATCH_DELETE),
                'entities' => $entities,
            ]);
        }

        return $this->genericFormFactory->create(BatchDeleteType::class, null, $options);
    }
962243
public static function deserializeResources($entityClass, string $rel, HalDocument $halDocument): HalResources
    {
        if ($halDocument->hasEmbedded($rel)) {
            $resources = array_map(function (HalDocument $embeddedDocument) use ($entityClass) {
                return self::deserializeResource($entityClass, $embeddedDocument);
            }, $halDocument->getEmbedded($rel));
        } else {
            $resources = [];
        }

        $data = $halDocument->getData();
        if (array_key_exists('page', $data)) {
            return new HalPagedResources($resources, $halDocument->getLinks(), new HalPageMetadata(
                $data['page']['number'],
                $data['page']['size'],
                $data['page']['totalElements'],
                $data['page']['totalPages']
            ));
        }

        return new HalResources($resources, $halDocument->getLinks());
    }
1100550
public function deserializeEntity(array $data, $entityOrClass)
    {
        $context = null;
        if (is_object($entityOrClass)) {
            $context = DeserializationContext::create();
            $context->attributes->set('target', $entityOrClass);
            $context->enableMaxDepthChecks(true);
            $entityOrClass = get_class($entityOrClass);
        }

        return $this->getSerializer()->deserialize(json_encode($data), $entityOrClass, 'json',  $context);
    }
814947
public function getByEntityBuilder($entityClass, $entityId, array $properties = [])
    {
        $qb = $this->createDefaultBuilder()
            ->andWhere('o.objectClass = :entity_class')
            ->setParameter('entity_class', $entityClass)
            ->andWhere('o.objectId = :entity_id')
            ->setParameter('entity_id', $entityId);

        return !empty($properties) ? $qb->andWhere($qb->expr()->in('o.property', $properties)) : $qb;
    }
877945
public function hasMetadata($entityOrClass)
    {
        $entityClass = is_object($entityOrClass) ? ClassUtils::getClass($entityOrClass) : $entityOrClass;

        if (isset($this->entityOverride[$entityClass])) {
            $entityClass = $this->entityOverride[$entityClass];
        }
        if (!isset($this->checkedIfHasMetadataClasses[$entityClass])) {
            $this->checkedIfHasMetadataClasses[$entityClass] = true;

            try {
                $this->getMetadata($entityClass);
            } catch (MetadataException $ex) {
                $this->checkedIfHasMetadataClasses[$entityClass] = false;
            }
        }

        return $this->checkedIfHasMetadataClasses[$entityClass];
    }
317912
protected function getEntityMapInstanceFromCache(string $entityClass)
    {
        if ($this->cache == null) {
            return;
        }

        if ($this->cache->has($entityClass)) {
            return unserialize($this->cache->get($entityClass));
        }
    }
102131
protected function getEntityClass($entityClass)
    {
        if (!isset($this->entityClasses[$entityClass])) {

            $found = class_exists($entityClass);

            if ($found) {
                $reflection = new \ReflectionClass($entityClass);
                $fqcn = '\\' . $reflection->getName();
            } elseif (strpos('\\', $entityClass) !== 0) {
                foreach ($this->entityNamespaces as $namespace) {
                    $fqcn = '\\' . trim($namespace, '\\') . '\\' . $entityClass;
                    if (class_exists($fqcn)) {
                        $found = true;
                        break;
                    }
                }
            }

            if (!$found) {
                throw new \DomainException('Entity class not found: ' . $entityClass);
            }

            $this->entityClasses[$entityClass] = $fqcn;
        }

        return $this->entityClasses[$entityClass];
    }
394508
public static TableModel entity2ReadOnlyModel(Class<?> entityClass) {
		DialectException.assureNotNull(entityClass, "Entity class can not be null");
		TableModel model = globalTableModelCache.get(entityClass);
		if (model != null)
			return model;
		model = entity2ModelWithConfig(entityClass);
		model.setReadOnly(true);
		globalTableModelCache.put(entityClass, model);
		return model;
	}
966389
private function createDescriptor($entityClass)
    {
        $descriptor = new EntityDescriptor($entityClass);
        $this->descriptors->set($entityClass, $descriptor);
        return $descriptor;
    }
1034907
private function getEntity($id, $entityClass = null)
    {
        if (empty($entityClass)) {
            $entityClass = $this->entityClass;
        }

        $entity = $this->getEntityManager()->find($entityClass, $id);

        if (empty($entity)) {
            throw $this->createNotFoundException(
                sprintf('Unable to find entity "%s" by ID "%d".', $entityClass, $id)
            );
        }

        return $entity;
    }
1350521
public static EntityTable getEntityTable(Class<?> entityClass) {
        EntityTable entityTable = entityTableMap.get(entityClass);
        if (entityTable == null) {
            throw new MapperException("无法获取实体类" + entityClass.getCanonicalName() + "对应的表名!");
        }
        return entityTable;
    }
810551
public function generateEntityRepositoryClass(string $entityClass, string $repositoryClass)
    {
        $variables = [
            '<namespace>' => $this->generateEntityRepositoryNamespace($repositoryClass),
            '<entityClassName>' => $entityClass,
            '<entity>' => $this->generateEntityName($entityClass),
            '<repository>' => $this->generateClassName($repositoryClass),
        ];

        return str_replace(array_keys($variables), array_values($variables), self::$_template);
    }
43024
public static function deserializeResource($entityClass, HalDocument $halDocument): HalResource
    {
        if (is_string($entityClass)) {
            /** @var Hydratable $entity */
            $entity = new $entityClass();
        } else {
            $entity = $entityClass($halDocument->getData());
        }

        $entity->hydrate($halDocument->getData(), $halDocument->getEmbeddedEntities());

        return new HalResource($entity, $halDocument->getLinks());
    }
653997
public EntityType getEntityType(Class<?> entityClass) {
    String className = entityClass.getName();
    EntityType type = entityTypes.get(className);
    if (null != type) { return type; }

    type = classEntityTypes.get(className);
    if (null == type) {
      List<EntityType> matched = CollectUtils.newArrayList();
      for (EntityType entityType : entityTypes.values()) {
        if (className.equals(entityType.getEntityName())
            || className.equals(entityType.getEntityClass().getName())) {
          matched.add(entityType);
        }
      }
      if (matched.size() > 1) { throw new RuntimeException("multi-entityName for class:" + className); }
      if (matched.isEmpty()) {
        EntityType tmp = new EntityType(entityClass);
        classEntityTypes.put(className, tmp);
        return tmp;
      } else {
        classEntityTypes.put(className, matched.get(0));
        type = (EntityType) matched.get(0);
      }
    }
    return type;
  }
398504
public function getRepository($entityClass)
    {
        if (is_object($entityClass)) {
            $entityClass = get_class($entityClass);
        }

        if (!isset($this->repositories[$entityClass])) {
            throw new \Exception("no repository defined for: $entityClass");
        }

        if (!is_object($this->repositories[$entityClass])) {
            $this->repositories[$entityClass] = $this->di->get($this->repositories[$entityClass]);
        }

        return $this->repositories[$entityClass];
    }