Get the hierarchy given a location sorted from root to the given
location.

@param string $id The location id.

@return LocationData[] Collection of locations

@throws EntityNotFoundException Entity not found
165262
public function getHierarchy($id)
    {
        $location = $this
            ->locationRepository
            ->findOneBy([
                'id' => $id,
            ]);

        if (empty($location)) {
            throw new EntityNotFoundException();
        }

        $parents = $location->getAllParents();
        $hierarchy = array_merge(
            $parents,
            [$location]
        );

        return $this->formatOutputLocationArray(
            $hierarchy
        );
    }
1294917
public function getParents($id)
    {
        $url = $this->buildUrlByMethodName(
            'getGetParentsUrl',
            ['id' => $id]
        );

        return $this
            ->buildLocations(
                $this->resolveApiUrl($url)
            );
    }
491601
public function loadPathData($id)
    {
        try {
            return $this->innerGateway->loadPathData($id);
        } catch (DBALException $e) {
            throw new \RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new \RuntimeException('Database error', 0, $e);
        }
    }
306504
public function get($id)
    {
        foreach ($this->data as $container) {
            if ($container->getId() === $id) {
                return $container;
            }
        }

        throw new ResourceNotFoundException(sprintf('Container "%s" not found.', $id));
    }
179791
public function getAncestry($id)
    {
        $all_results = new Collection(DB::select($this->getAncestryInitialQuery(), [':id' => $id]));

        if (count($all_results)) {
            $this->getRecursiveAncestry($all_results, $all_results->lists('parent_id'));
        }

        return $all_results;
    }
1290834
protected function doContains($id)
    {
        $found = false;
        $this->delegate->get($id, null, $found);
        return $found;
    }
1243731
public function reverseTransform($id)
    {
        if (null == $id) {
            return null;
        }

        $entity = $this->contentManager->getRepository()->find($id);

        return $entity;
    }
551457
public function getSchoolsByLocation($id) {
    $schools = [];

    $cid = __METHOD__ . $id;
    if ($cache = $this->cache->get($cid)) {
      return $cache->data;
    }

    $programs = $this->getChildCareProgramsByLocation($id);
    foreach ($programs as $program) {
      $schools_data = $this->getSchoolsByChildCareProgramId($program);
      foreach ($schools_data as $school) {
        $schools[$school['id']] = $school['name'];
      }
    }

    $this->cache->set($cid, $schools);
    return $schools;
  }
24740
public function getChilds($id)
    {
        $result = [];
        if (array_key_exists($id, $this->finder)) {
            return $this->recursiveGetChilds($this->finder[$id][$this->config['childs']], $result);
        } else {
            return $result;
        }
    }
1147250
public function loadUrlAlias($id)
    {
        list($parentId, $textMD5) = explode('-', $id);
        $data = $this->gateway->loadRow($parentId, $textMD5);

        if (empty($data)) {
            throw new NotFoundException('URLAlias', $id);
        }

        $data['raw_path_data'] = $this->gateway->loadPathData($data['id']);

        return $this->mapper->extractUrlAliasFromData($data);
    }
684176
public function findOneById($id)
    {
        $persister = $this->entityManager->getEntityPersister($this->className);

        return $persister->loadOneById($id);
    }
936594
public static function get($id)
    {
        /** @var Entity $entity */
        $entity = new static();
        Manager::getInstance()->get($entity)->refreshRelations();
        $className = $entity->getClassName();
        $sql = Sql::createSql($entity->getAdapter())
            ->select($entity->getTableName())
            ->where(
                [
                    "{$entity->getTableName()}.{$entity->_primaryKey} = :id" =>
                        [
                            ':id' => $id
                        ]
                ]
            );
        $events = $entity->getEventManager();
        $event = new Select([
            'sqlQuery' => $sql,
            'params' => compact('id'),
            'action' => Select::GET,
            'singleItem' => true
        ]);
        $events->trigger(Select::BEFORE_SELECT, $entity, $event);
        $row = $event->sqlQuery->first();

        if ($row) {
            $event->data = $row;
            $events->trigger(Select::AFTER_SELECT, $entity, $event);
            $object = new $className($event->data);
            return $object;
        }
        return null;
    }
124194
public function getPath( $id )
	{
		$list = $this->manager->getPath( $id, $this->domains );

		if( $this->root )
		{
			foreach( $list as $key => $item )
			{
				if( $key == $this->root ) {
					break;
				}
				unset( $list[$key] );
			}
		}

		return $list;
	}
736887
public function tree($id = null)
    {
        $id = ($id == null) ? $this->root : $id;
        return $this->stack[$id];
    }
609281
public function showAction($id)
    {
        $em = $this->getDoctrine()->getEntityManager();

        $entity = $em->getRepository('DMSLauncherBundle:PreUser')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find PreUser entity.');
        }

        return array(
            'entity'        => $entity,
            'referralCount' => $em->getRepository('DMSLauncherBundle:PreUser')->getReferralsCount($entity->getToken()),
        );
    }
28913
public function getOriginalEntityState($id)
    {
        if (isset($this->entityStateReferences[$id])) {
            return $this->entityStateReferences[$id];
        }

        return null;
    }
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;
    }