Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

can retrieve descendants of given class

  • Loading branch information...
commit bec5a2819c2f502539160f5cf7b4c8ce21a47eb5 1 parent 052d2a9
@juzna authored
Showing with 7 additions and 5 deletions.
  1. +7 −5 lib/Gedmo/Tree/Entity/Repository/NestedTreeRepository.php
View
12 lib/Gedmo/Tree/Entity/Repository/NestedTreeRepository.php
@@ -227,7 +227,7 @@ public function childCount($node = null, $direct = false)
* @param string $sortByField - field name to sort by
* @param string $direction - sort direction : "ASC" or "DESC"
* @throws InvalidArgumentException - if input is not valid
- * @return Doctrine\ORM\QueryBuilder
+ * @return \Doctrine\ORM\QueryBuilder
*/
public function childrenQueryBuilder($node = null, $direct = false, $sortByField = null, $direction = 'ASC')
{
@@ -239,7 +239,9 @@ public function childrenQueryBuilder($node = null, $direct = false, $sortByField
->from($config['useObjectClass'], 'node')
;
if ($node !== null) {
- if ($node instanceof $meta->name) {
+// WTF? Seriously? Why you do this to me?
+// if ($node instanceof $meta->name) {
+// FIXME: should check if has common ancestor which is a base tree node
$wrapped = new EntityWrapper($node, $this->_em);
if (!$wrapped->hasValidIdentifier()) {
throw new InvalidArgumentException("Node is not managed by UnitOfWork");
@@ -261,9 +263,9 @@ public function childrenQueryBuilder($node = null, $direct = false, $sortByField
$rootId = $wrapped->getPropertyValue($config['root']);
$qb->andWhere("node.{$config['root']} = {$rootId}");
}
- } else {
- throw new \InvalidArgumentException("Node is not related to this repository");
- }
+// } else {
+// throw new \InvalidArgumentException("Node is not related to this repository");
+// }
} else {
if ($direct) {
$qb->where('node.' . $config['parent'] . ' IS NULL');
Please sign in to comment.
Something went wrong with that request. Please try again.