@param string $entityName Entity name

@return \Darvin\AdminBundle\Metadata\Metadata
@throws \Darvin\AdminBundle\Search\SearchException
506482
public function getSearchableEntityMeta($entityName)
    {
        $allMeta = $this->getSearchableEntitiesMeta();

        if (!isset($allMeta[$entityName])) {
            throw new SearchException(sprintf('Entity "%s" is not searchable.', $entityName));
        }

        return $allMeta[$entityName];
    }
1105852
private function getEntityName($methodName)
    {
        if (!preg_match('/^get(.+)$/', $methodName, $matchesArray)) {
            throw new \BadMethodCallException(
                sprintf(
                    'Method %s::%s does not exist',
                    get_class($this),
                    $methodName
                )
            );
        }

        if (!isset($this->methodNameEntityMap[$matchesArray[1]])) {
            throw new \BadMethodCallException(
                sprintf(
                    '%s is missing an methodNameMap entry for %s',
                    get_class($this),
                    $methodName
                )
            );
        }

        return $this->methodNameEntityMap[$matchesArray[1]];
    }
712992
protected function getFieldsView($entityName)
    {
        return $this->handleView($this->view(array_values($this->getFieldDescriptors($entityName, null)), 200));
    }
65725
public function getRepositories(array $entityNames)
    {
        $repositoryCollection = new EntityRepositoryCollection($this);
        foreach ($entityNames as $entityName) {
            $repositoryCollection->addRepository($this->getRepository($entityName));
        }
        return $repositoryCollection;
    }
665742
public function getManager($entityName)
    {
    	$entityName = ltrim($entityName, '\\');

    	if (isset($this->repositories[$entityName])) {
    		return $this->repositories[$entityName];
    	}
    	$repositoryClassName = ltrim($entityName::MANAGER_CLASS_NAME, '\\');

    	$repository = new $repositoryClassName($this,$entityName);

    	$this->repositories[$entityName] = $repository;

    	return $repository;
    }
1227777
protected function getChoicesByEntity($entityName)
    {
        $choices = [];
        foreach ($this->em->getRepository($entityName)->findAll() as $choice) {
            $choices[(string) $choice] = $choice->getId();
        }

        return $choices;
    }
586575
public function getMetadataFor($entityName, array $parentName = array())
    {
        return $this->hydrateDataObject(
            $this->entityManager->getMetadataFactory()->getMetadataFor($entityName),
            $parentName
        );
    }
418026
protected function getListBuilder($entityName, $fieldDescriptors)
    {
        /** @var RestHelperInterface $restHelper */
        $restHelper = $this->get('sulu_core.doctrine_rest_helper');

        /** @var DoctrineListBuilderFactory $factory */
        $factory = $this->get('sulu_core.doctrine_list_builder_factory');

        $listBuilder = $factory->create($entityName);

        $restHelper->initializeListBuilder(
            $listBuilder,
            $fieldDescriptors
        );

        return $listBuilder;
    }
739095
public function createNode($tagName, $entityName = null)
    {
        if ($tagName instanceof Element) {
            $this->push($tagName);
        } else {
            $this->push(new Element($tagName, $entityName));
        }

        return $this->last();
    }
1166684
public function retrievePageElements($entityName, $page)
    {
        $page = $page < 1 ? 1 : $page;

        $qb = $this->createQueryBuilder($entityName);
        $qb
            ->setMaxResults($this->itemPerPage)
            ->setFirstResult(($page-1) * $this->itemPerPage)
        ;

        $paginator = new Paginator($qb, true);

        $this->page = $page;
        $this->count = $paginator->count();
        $this->results = $paginator->getIterator();
        $this->maxPage = ceil($this->count / $this->itemPerPage);

        return $this;
    }
701182
public function getRepository($entityName)
    {
        if (isset($this->repositories[$entityName])) {
            return $this->repositories[$entityName];
        }

        $metadata = $this->getClassMetadata($entityName);
        $repository = new EntityRepository($this, $metadata);
        $this->repositories[$entityName] = $repository;

        return $repository;
    }
1171255
public function getRepository(EntityManagerInterface $entityManager, $entityName)
    {
        return $this->repositorySubManager->get($this->entityRepositoryMapping->getRepositoryByEntity($entityName));
    }
1150821
protected function getTableName($entityName)
    {
        $tableName = $entityName;
        preg_match_all('/[A-Z][a-z]+/', $entityName, $matches);
        if (!empty($matches[0])) {
            $tableName = implode('_', $matches[0]);
        }
        return strtolower($tableName);
    }
784761
public static function getFirstEntityValue($entityName, array $entities)
    {
        if (!isset($entities[$entityName][0]['value'])) {
            return null;
        }

        $val = $entities[$entityName][0]['value'];

        return is_array($val) && isset($val['value']) ? $val['value'] : $val;
    }
530086
public function getEntityPath($entityName, $delim = '\\')
    {
        $path = $this->getScopePath($entityName, $delim);

        return implode($delim, array($path, 'Entities', Util::normilizeClassName(ucfirst($entityName))));
    }
688231
protected function lookUpEntity($entityId) {
        $entity = $this->generateEntity();
        $entityInstance = $entity->findFirst($entityId);
        if($entityInstance === false) {
            throw new Exception("Invalid Entity Id: Entity not found.", 404);
        }
        return $entityInstance;
    }
222942
public function resultsAction($entityName, $query)
    {
        $searcher = $this->getSearcher();

        if (!$searcher->isSearchable($entityName)) {
            throw $this->createNotFoundException(sprintf('Entity "%s" is not searchable.', $entityName));
        }

        $entities = $this->getSearcher()->search($entityName, $query);

        $meta = $searcher->getSearchableEntityMeta($entityName);

        $batchDeleteForm = null;

        if (!empty($entities)
            && $this->isGranted(Permission::CREATE_DELETE, $meta->getEntityClass())
            && $this->getAdminRouter()->isRouteExists($meta->getEntityClass(), AdminRouter::TYPE_BATCH_DELETE)
        ) {
            $batchDeleteForm = $this->getAdminFormFactory()->createBatchDeleteForm($meta->getEntityClass(), $entities)->createView();
        }

        $view = $this->getEntitiesToIndexViewTransformer()->transform($meta, $entities);

        return $this->render('DarvinAdminBundle:Search/widget:results.html.twig', [
            'batch_delete_form' => $batchDeleteForm,
            'entities_count'    => count($entities),
            'meta'              => $meta,
            'view'              => $view,
        ]);
    }