Conditions | 6 |
Paths | 8 |
Total Lines | 25 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 42 |
Changes | 0 |
1 | <?php |
||
9 | public function getTreeForSelect($order = null, $where = null) |
||
10 | { |
||
11 | $qb = $this->_em->createQueryBuilder(); |
||
12 | |||
13 | if ($order) { |
||
14 | foreach ($order as $o) { |
||
15 | $qb->addOrderBy('l.'.$o['by'], $o['dir']); |
||
16 | } |
||
17 | } |
||
18 | |||
19 | if ($where) { |
||
20 | foreach ($where as $w) { |
||
21 | $qb->andWhere('l.'.$w); |
||
22 | } |
||
23 | } |
||
24 | |||
25 | $tree = $qb->select('l')->from("WebCMS\Entity\Page", 'l')->getQuery()->getResult(); |
||
26 | |||
27 | $array = array(); |
||
28 | foreach ($tree as $node) { |
||
29 | $array[$node->getId()] = str_repeat("-", $node->getLevel()).$node->getTitle(); |
||
30 | } |
||
31 | |||
32 | return $array; |
||
33 | } |
||
34 | } |
||
35 |