Skip to content

Commit

Permalink
add sorted ltree
Browse files Browse the repository at this point in the history
  • Loading branch information
pvsaintpe committed Apr 26, 2019
1 parent 955e069 commit 68081ed
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Repository/LTreeEntityRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,19 @@ public function getAllParent($entity, $hydrate = Query::HYDRATE_OBJECT)
return $this->getAllParentQueryBuilder($entity)->getQuery()->getResult($hydrate);
}

/**
* @param int $hydrate
* @return array|mixed
* @throws PropertyNotFoundException
* @throws ReflectionException
*/
public function getAllLTree($hydrate = Query::HYDRATE_OBJECT)
{
$entityClassName = $this->getClassName();
$entity = new $entityClassName;
return $this->getInverseLTreeBuilder($entity)->getQuery()->getResult($hydrate);
}

/**
* @param object $entity
* @param bool $treeMode
Expand Down
7 changes: 7 additions & 0 deletions Repository/LTreeEntityRepositoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ public function getAllParentQueryBuilder($entity): QueryBuilder;
*/
public function getAllParent($entity, $hydrate = Query::HYDRATE_OBJECT);

/**
* @param int $hydrate Doctrine processing mode to be used during hydration process.
* One of the Query::HYDRATE_* constants.
* @return array|mixed with parents for $entity. The root node is last
*/
public function getAllLTree($hydrate = Query::HYDRATE_OBJECT);

/**
* @param object $entity object entity
* @return QueryBuilder
Expand Down

0 comments on commit 68081ed

Please sign in to comment.