Completed
Push — develop ( 584597...ae5bdc )
by Bartko
11:59
created

Zend1::getAncestors()   B

Complexity

Conditions 5
Paths 9

Size

Total Lines 39
Code Lines 21

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 21
CRAP Score 5

Importance

Changes 0
Metric Value
dl 0
loc 39
ccs 21
cts 21
cp 1
rs 8.439
c 0
b 0
f 0
nc 9
cc 5
eloc 21
nop 3
crap 5
1
<?php
2
3
declare(strict_types=1);
4
5
namespace StefanoTree\NestedSet\Adapter;
6
7
use StefanoTree\NestedSet\NodeInfo;
8
use StefanoTree\NestedSet\Options;
9
use Zend_Db_Adapter_Abstract as ZendDbAdapter;
10
use Zend_Db_Select as ZendDbSelect;
11
12
class Zend1 extends AdapterAbstract implements AdapterInterface
13
{
14
    protected $dbAdapter;
15
16 55
    public function __construct(Options $options, ZendDbAdapter $dbAdapter)
17
    {
18 55
        $this->setOptions($options);
19 55
        $this->setDbAdapter($dbAdapter);
20 55
    }
21
22
    /**
23
     * @param ZendDbAdapter $dbAdapter
24
     */
25 55
    protected function setDbAdapter(ZendDbAdapter $dbAdapter): void
26
    {
27 55
        $this->dbAdapter = $dbAdapter;
28 55
    }
29
30
    /**
31
     * @return ZendDbAdapter
32
     */
33 52
    public function getDbAdapter(): ZendDbAdapter
34
    {
35 52
        return $this->dbAdapter;
36
    }
37
38
    /**
39
     * {@inheritdoc}
40
     *
41
     * @return ZendDbSelect
42
     */
43 32
    public function getBlankDbSelect(): ZendDbSelect
44
    {
45 32
        return $this->getDbAdapter()
46 32
            ->select()
47 32
            ->from($this->getOptions()->getTableName());
48
    }
49
50
    /**
51
     * Return default db select. Always new instance.
52
     *
53
     * @return ZendDbSelect
54
     */
55 17
    public function getDefaultDbSelect(): ZendDbSelect
56
    {
57 17
        return $this->getDbSelectBuilder()();
58
    }
59
60
    /**
61
     * {@inheritdoc}
62
     */
63 1
    public function lockTree(): void
64
    {
65 1
        $options = $this->getOptions();
66
67 1
        $dbAdapter = $this->getDbAdapter();
68
69 1
        $select = $this->getBlankDbSelect()
70 1
            ->reset(\Zend_Db_Select::COLUMNS)
71 1
            ->columns(array('i' => $options->getIdColumnName(true)))
72 1
            ->forUpdate(true);
73
74 1
        $dbAdapter->fetchAll($select);
75 1
    }
76
77
    /**
78
     * {@inheritdoc}
79
     */
80 1
    public function beginTransaction(): void
81
    {
82 1
        $this->getDbAdapter()->beginTransaction();
83 1
    }
84
85
    /**
86
     * {@inheritdoc}
87
     */
88 1
    public function commitTransaction(): void
89
    {
90 1
        $this->getDbAdapter()->commit();
91 1
    }
92
93
    /**
94
     * {@inheritdoc}
95
     */
96 1
    public function rollbackTransaction(): void
97
    {
98 1
        $this->getDbAdapter()->rollBack();
99 1
    }
100
101
    /**
102
     * {@inheritdoc}
103
     */
104 3
    public function update($nodeId, array $data): void
105
    {
106 3
        $options = $this->getOptions();
107
108 3
        $dbAdapter = $this->getDbAdapter();
109
110 3
        $data = $this->cleanData($data);
111
112
        $where = array(
113 3
            $dbAdapter->quoteIdentifier($options->getIdColumnName()).' = ?' => $nodeId,
114
        );
115 3
        $dbAdapter->update($options->getTableName(), $data, $where);
116 3
    }
117
118
    /**
119
     * {@inheritdoc}
120
     */
121 3
    public function insert(NodeInfo $nodeInfo, array $data)
122
    {
123 3
        $options = $this->getOptions();
124 3
        $dbAdapter = $this->getDbAdapter();
125
126 3
        $data[$options->getParentIdColumnName()] = $nodeInfo->getParentId();
127 3
        $data[$options->getLevelColumnName()] = $nodeInfo->getLevel();
128 3
        $data[$options->getLeftColumnName()] = $nodeInfo->getLeft();
129 3
        $data[$options->getRightColumnName()] = $nodeInfo->getRight();
130
131 3
        if ($options->getScopeColumnName()) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $options->getScopeColumnName() of type string|null is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
132 1
            $data[$options->getScopeColumnName()] = $nodeInfo->getScope();
133
        }
134
135 3
        $dbAdapter->insert($options->getTableName(), $data);
136 3
        if ('' != $options->getSequenceName()) {
137 3
            $lastGeneratedValue = $dbAdapter->lastSequenceId($options->getSequenceName());
138
        } else {
139
            $lastGeneratedValue = $dbAdapter->lastInsertId();
140
        }
141
142 3
        return $lastGeneratedValue;
143
    }
144
145
    /**
146
     * {@inheritdoc}
147
     */
148 2
    public function delete($nodeId): void
149
    {
150 2
        $options = $this->getOptions();
151
152 2
        $dbAdapter = $this->getDbAdapter();
153
154
        $where = array(
155 2
            $dbAdapter->quoteIdentifier($options->getIdColumnName()).' = ?' => $nodeId,
156
        );
157
158 2
        $dbAdapter->delete($options->getTableName(), $where);
159 2
    }
160
161
    /**
162
     * {@inheritdoc}
163
     */
164 2
    public function moveLeftIndexes($fromIndex, $shift, $scope = null): void
165
    {
166 2
        $options = $this->getOptions();
167
168 2
        if (0 == $shift) {
169
            return;
170
        }
171
172 2
        $dbAdapter = $this->getDbAdapter();
173 2
        $sql = 'UPDATE '.$dbAdapter->quoteIdentifier($options->getTableName())
174 2
            .' SET '.$dbAdapter->quoteIdentifier($options->getLeftColumnName())
175 2
            .' = '.$dbAdapter->quoteIdentifier($options->getLeftColumnName()).' + :shift'
176 2
            .' WHERE '.$dbAdapter->quoteIdentifier($options->getLeftColumnName()).' > :fromIndex';
177
178 2
        if ($options->getScopeColumnName()) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $options->getScopeColumnName() of type string|null is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
179 1
            $sql .= ' AND '.$dbAdapter->quoteIdentifier($options->getScopeColumnName()).' = '.$dbAdapter->quote($scope);
180
        }
181
182
        $binds = array(
183 2
            ':shift' => $shift,
184 2
            ':fromIndex' => $fromIndex,
185
        );
186 2
        $dbAdapter->prepare($sql)->execute($binds);
187 2
    }
188
189
    /**
190
     * {@inheritdoc}
191
     */
192 2
    public function moveRightIndexes($fromIndex, $shift, $scope = null): void
193
    {
194 2
        $options = $this->getOptions();
195
196 2
        if (0 == $shift) {
197
            return;
198
        }
199
200 2
        $dbAdapter = $this->getDbAdapter();
201
202 2
        $sql = 'UPDATE '.$dbAdapter->quoteIdentifier($options->getTableName())
203 2
            .' SET '.$dbAdapter->quoteIdentifier($options->getRightColumnName())
204 2
            .' = '.$dbAdapter->quoteIdentifier($options->getRightColumnName()).' + :shift'
205 2
            .' WHERE '.$dbAdapter->quoteIdentifier($options->getRightColumnName()).' > :fromIndex';
206
207 2
        if ($options->getScopeColumnName()) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $options->getScopeColumnName() of type string|null is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
208 1
            $sql .= ' AND '.$dbAdapter->quoteIdentifier($options->getScopeColumnName()).' = '.$dbAdapter->quote($scope);
209
        }
210
211
        $binds = array(
212 2
            ':shift' => $shift,
213 2
            ':fromIndex' => $fromIndex,
214
        );
215
216 2
        $dbAdapter->prepare($sql)->execute($binds);
217 2
    }
218
219
    /**
220
     * {@inheritdoc}
221
     */
222 1
    public function updateParentId($nodeId, $newParentId): void
223
    {
224 1
        $options = $this->getOptions();
225
226 1
        $dbAdapter = $this->getDbAdapter();
227
228
        $bind = array(
229 1
            $options->getParentIdColumnName() => $newParentId,
230
        );
231
232
        $where = array(
233 1
            $dbAdapter->quoteIdentifier($options->getIdColumnName()).' = ?' => $nodeId,
234
        );
235 1
        $dbAdapter->update($options->getTableName(), $bind, $where);
236 1
    }
237
238
    /**
239
     * {@inheritdoc}
240
     */
241 2
    public function updateLevels(int $leftIndexFrom, int $rightIndexTo, int $shift, $scope = null): void
242
    {
243 2
        $options = $this->getOptions();
244
245 2
        if (0 == $shift) {
246
            return;
247
        }
248
249 2
        $dbAdapter = $this->getDbAdapter();
250
251 2
        $sql = 'UPDATE '.$dbAdapter->quoteIdentifier($options->getTableName())
252 2
            .' SET '.$dbAdapter->quoteIdentifier($options->getLevelColumnName())
253 2
            .' = '.$dbAdapter->quoteIdentifier($options->getLevelColumnName()).' + :shift'
254 2
            .' WHERE '.$dbAdapter->quoteIdentifier($options->getLeftColumnName())
255 2
            .' >= :leftFrom'.' AND '.$dbAdapter->quoteIdentifier($options->getRightColumnName())
256 2
            .' <= :rightTo';
257
258 2
        if ($options->getScopeColumnName()) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $options->getScopeColumnName() of type string|null is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
259 1
            $sql .= ' AND '.$dbAdapter->quoteIdentifier($options->getScopeColumnName()).' = '.$dbAdapter->quote($scope);
260
        }
261
262
        $binds = array(
263 2
            ':shift' => $shift,
264 2
            ':leftFrom' => $leftIndexFrom,
265 2
            ':rightTo' => $rightIndexTo,
266
        );
267
268 2
        $dbAdapter->prepare($sql)->execute($binds);
269 2
    }
270
271
    /**
272
     * {@inheritdoc}
273
     */
274 2
    public function moveBranch(int $leftIndexFrom, int $rightIndexTo, int $shift, $scope = null): void
275
    {
276 2
        if (0 == $shift) {
277
            return;
278
        }
279
280 2
        $options = $this->getOptions();
281
282 2
        $dbAdapter = $this->getDbAdapter();
283
284 2
        $sql = 'UPDATE '.$dbAdapter->quoteIdentifier($options->getTableName())
285 2
            .' SET '.$dbAdapter->quoteIdentifier($options->getLeftColumnName())
286 2
            .' = '.$dbAdapter->quoteIdentifier($options->getLeftColumnName()).' + :shift, '
287 2
            .$dbAdapter->quoteIdentifier($options->getRightColumnName())
288 2
            .' = '.$dbAdapter->quoteIdentifier($options->getRightColumnName()).' + :shift'
289 2
            .' WHERE '.$dbAdapter->quoteIdentifier($options->getLeftColumnName()).' >= :leftFrom'
290 2
            .' AND '.$dbAdapter->quoteIdentifier($options->getRightColumnName()).' <= :rightTo';
291
292 2
        if ($options->getScopeColumnName()) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $options->getScopeColumnName() of type string|null is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
293 1
            $sql .= ' AND '.$dbAdapter->quoteIdentifier($options->getScopeColumnName()).' = '.$dbAdapter->quote($scope);
294
        }
295
296
        $binds = array(
297 2
            ':shift' => $shift,
298 2
            ':leftFrom' => $leftIndexFrom,
299 2
            ':rightTo' => $rightIndexTo,
300
        );
301
302 2
        $dbAdapter->prepare($sql)->execute($binds);
303 2
    }
304
305
    /**
306
     * {@inheritdoc}
307
     */
308 4
    public function getRoots($scope = null): array
309
    {
310 4
        $options = $this->getOptions();
311
312 4
        $dbAdapter = $this->getDbAdapter();
313
314 4
        $select = $this->getBlankDbSelect()
315 4
            ->where($options->getParentIdColumnName(true).' IS NULL')
316 4
            ->order($options->getIdColumnName(true));
317
318 4
        if (null != $scope && $options->getScopeColumnName()) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $options->getScopeColumnName() of type string|null is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
319 1
            $select->where($options->getScopeColumnName(true).' = ?', $scope);
320
        }
321
322 4
        return $dbAdapter->fetchAll($select);
323
    }
324
325
    /**
326
     * {@inheritdoc}
327
     */
328 2
    public function getRoot($scope = null): array
329
    {
330 2
        $result = $this->getRoots($scope);
331
332 2
        return ($result) ? $result[0] : array();
333
    }
334
335
    /**
336
     * {@inheritdoc}
337
     */
338 2
    public function getNode($nodeId): ?array
339
    {
340 2
        $options = $this->getOptions();
341
342 2
        $nodeId = (int) $nodeId;
343
344 2
        $dbAdapter = $this->getDbAdapter();
345
346 2
        $select = $this->getDefaultDbSelect()
347 2
            ->where($options->getIdColumnName(true).' = ?', $nodeId);
348
349 2
        $row = $dbAdapter->fetchRow($select);
350
351 2
        return $row ? $row : null;
352
    }
353
354
    /**
355
     * {@inheritdoc}
356
     */
357 19
    public function getNodeInfo($nodeId): ?NodeInfo
358
    {
359 19
        $options = $this->getOptions();
360
361 19
        $nodeId = (int) $nodeId;
362
363 19
        $dbAdapter = $this->getDbAdapter();
364
365 19
        $select = $this->getBlankDbSelect()
366 19
            ->where($options->getIdColumnName(true).' = ?', $nodeId);
367
368 19
        $row = $dbAdapter->fetchRow($select);
369
370 19
        $data = $row ? $row : null;
371
372 19
        $result = ($data) ? $this->_buildNodeInfoObject($data) : null;
373
374 19
        return $result;
375
    }
376
377
    /**
378
     * {@inheritdoc}
379
     */
380 4
    public function getChildrenNodeInfo($parentNodeId): array
381
    {
382 4
        $dbAdapter = $this->getDbAdapter();
383 4
        $options = $this->getOptions();
384
385
        $columns = array(
386 4
            $options->getIdColumnName(),
387 4
            $options->getLeftColumnName(),
388 4
            $options->getRightColumnName(),
389 4
            $options->getParentIdColumnName(),
390 4
            $options->getLevelColumnName(),
391
        );
392
393 4
        if ($options->getScopeColumnName()) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $options->getScopeColumnName() of type string|null is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
394 2
            $columns[] = $options->getScopeColumnName();
395
        }
396
397 4
        $select = $this->getBlankDbSelect();
398 4
        $select->reset(\Zend_Db_Select::COLUMNS);
399 4
        $select->columns($columns);
400 4
        $select->order($options->getLeftColumnName(true));
401 4
        $select->where($options->getParentIdColumnName(true).' = ?', $parentNodeId);
402
403 4
        $data = $dbAdapter->fetchAll($select);
404
405 4
        $result = array();
406
407 4
        foreach ($data as $nodeData) {
408 3
            $result[] = $this->_buildNodeInfoObject($nodeData);
409
        }
410
411 4
        return $result;
412
    }
413
414
    /**
415
     * {@inheritdoc}
416
     */
417 2
    public function updateNodeMetadata(NodeInfo $nodeInfo): void
418
    {
419 2
        $dbAdapter = $this->getDbAdapter();
420 2
        $options = $this->getOptions();
421
422
        $bind = array(
423 2
            $options->getRightColumnName() => $nodeInfo->getRight(),
424 2
            $options->getLeftColumnName() => $nodeInfo->getLeft(),
425 2
            $options->getLevelColumnName() => $nodeInfo->getLevel(),
426
        );
427
428
        $where = array(
429 2
            $dbAdapter->quoteIdentifier($options->getIdColumnName()).' = ?' => $nodeInfo->getId(),
430
        );
431
432 2
        $dbAdapter->update($options->getTableName(), $bind, $where);
433 2
    }
434
435
    /**
436
     * {@inheritdoc}
437
     */
438 6
    public function getAncestors($nodeId, int $startLevel = 0, int $excludeLastNLevels = 0): array
439
    {
440 6
        $options = $this->getOptions();
441
442
        // node does not exist
443 6
        if (!$nodeInfo = $this->getNodeInfo($nodeId)) {
444 1
            return array();
445
        }
446
447 5
        $dbAdapter = $this->getDbAdapter();
448
449 5
        $select = $this->getDefaultDbSelect();
450
451 5
        if ($options->getScopeColumnName()) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $options->getScopeColumnName() of type string|null is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
452 2
            $select->where($options->getScopeColumnName(true).' = ?', $nodeInfo->getScope());
453
        }
454
455 5
        $select->where(
456 5
            $dbAdapter->quoteIdentifier($options->getLeftColumnName(true)).' <= ?', $nodeInfo->getLeft()
457 5
        )->where(
458 5
            $dbAdapter->quoteIdentifier($options->getRightColumnName(true)).' >= ?', $nodeInfo->getRight()
459 5
        )->order($options->getLeftColumnName(true).' ASC');
460
461 5
        if (0 < $startLevel) {
462 2
            $select->where(
463 2
                $dbAdapter->quoteIdentifier($options->getLevelColumnName(true)).' >= ?', $startLevel
464
            );
465
        }
466
467 5
        if (0 < $excludeLastNLevels) {
468 2
            $select->where(
469 2
                $dbAdapter->quoteIdentifier($options->getLevelColumnName(true)).' <= ?', $nodeInfo->getLevel() - $excludeLastNLevels
470
            );
471
        }
472
473 5
        $result = $dbAdapter->fetchAll($select);
474
475 5
        return $result;
476
    }
477
478
    /**
479
     * {@inheritdoc}
480
     */
481 9
    public function getDescendants($nodeId, int $startLevel = 0, ?int $levels = null, $excludeBranch = null): array
482
    {
483 9
        $options = $this->getOptions();
484
485 9
        if (!$nodeInfo = $this->getNodeInfo($nodeId)) {
486 1
            return array();
487
        }
488
489 8
        $dbAdapter = $this->getDbAdapter();
490 8
        $select = $this->getDefaultDbSelect();
491 8
        $select->order($options->getLeftColumnName(true).' ASC');
492
493 8
        if ($options->getScopeColumnName()) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $options->getScopeColumnName() of type string|null is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
494 3
            $select->where($options->getScopeColumnName(true).' = ?', $nodeInfo->getScope());
495
        }
496
497 8
        if (0 != $startLevel) {
498 3
            $level = $nodeInfo->getLevel() + $startLevel;
499 3
            $select->where(
500 3
                $dbAdapter->quoteIdentifier($options->getLevelColumnName(true)).' >= ?', $level
501
            );
502
        }
503
504 8
        if (null != $levels) {
0 ignored issues
show
Bug Best Practice introduced by
It seems like you are loosely comparing $levels of type null|integer against null; this is ambiguous if the integer can be zero. Consider using a strict comparison !== instead.
Loading history...
505 2
            $endLevel = $nodeInfo->getLevel() + $startLevel + abs($levels);
506 2
            $select->where(
507 2
                $dbAdapter->quoteIdentifier($options->getLevelColumnName(true)).' < ?', $endLevel
508
            );
509
        }
510
511 8
        if (null != $excludeBranch && null != ($excludeNodeInfo = $this->getNodeInfo($excludeBranch))) {
512 2
            $where = sprintf(
513 2
                '(%s OR %s) AND (%s OR %s)',
514 2
                $this->getWhereBetween($options->getLeftColumnName(true), $nodeInfo->getLeft(), $excludeNodeInfo->getLeft() - 1),
515 2
                $this->getWhereBetween($options->getLeftColumnName(true),
516 2
                    $excludeNodeInfo->getRight() + 1, $nodeInfo->getRight()),
517 2
                $this->getWhereBetween($options->getRightColumnName(true),
518 2
                    $excludeNodeInfo->getRight() + 1, $nodeInfo->getRight()),
519 2
                $this->getWhereBetween($options->getRightColumnName(true),
520 2
                    $nodeInfo->getLeft(), $excludeNodeInfo->getLeft() - 1)
521
            );
522 2
            $select->where($where);
523
        } else {
524 6
            $select->where(
525 6
                $dbAdapter->quoteIdentifier($options->getLeftColumnName(true)).' >= ?', $nodeInfo->getLeft()
526
            );
527 6
            $select->where(
528 6
                $dbAdapter->quoteIdentifier($options->getRightColumnName(true)).' <= ?', $nodeInfo->getRight()
529
            );
530
        }
531
532 8
        $resultArray = $dbAdapter->fetchAll($select);
533
534 8
        return (0 < count($resultArray)) ? $resultArray : array();
535
    }
536
537 2
    protected function getWhereBetween($column, $first, $second)
538
    {
539 2
        $dbAdapter = $this->getDbAdapter();
540 2
        $quotedColumn = $dbAdapter->quoteIdentifier($column);
541 2
        $quotedFirst = $dbAdapter->quote($first);
542 2
        $quotedSecond = $dbAdapter->quote($second);
543
544 2
        return sprintf('(%s BETWEEN %s AND %s)', $quotedColumn, $quotedFirst, $quotedSecond);
545
    }
546
}
547