| @@ 1039-1055 (lines=17) @@ | ||
| 1036 | * @param int $right |
|
| 1037 | * @return array|null |
|
| 1038 | */ |
|
| 1039 | protected function findInsertBeforeRange(&$left, &$right) |
|
| 1040 | { |
|
| 1041 | $result = null; |
|
| 1042 | $right = $this->node->getAttribute($this->leftAttribute); |
|
| 1043 | $left = $this->getNodeBehavior()->getPrev() |
|
| 1044 | ->select($this->rightAttribute) |
|
| 1045 | ->scalar(); |
|
| 1046 | if ($left === false) { |
|
| 1047 | $result = $this->getNodeBehavior()->getParent() |
|
| 1048 | ->select([$this->leftAttribute, $this->rightAttribute]) |
|
| 1049 | ->createCommand() |
|
| 1050 | ->queryOne(); |
|
| 1051 | $left = $result[$this->leftAttribute]; |
|
| 1052 | } |
|
| 1053 | $left = (int)$left; |
|
| 1054 | return $result; |
|
| 1055 | } |
|
| 1056 | ||
| 1057 | /** |
|
| 1058 | * @param int $left |
|
| @@ 1062-1078 (lines=17) @@ | ||
| 1059 | * @param int $right |
|
| 1060 | * @return array|null |
|
| 1061 | */ |
|
| 1062 | protected function findInsertAfterRange(&$left, &$right) |
|
| 1063 | { |
|
| 1064 | $result = null; |
|
| 1065 | $left = $this->node->getAttribute($this->rightAttribute); |
|
| 1066 | $right = $this->getNodeBehavior()->getNext() |
|
| 1067 | ->select($this->leftAttribute) |
|
| 1068 | ->scalar(); |
|
| 1069 | if ($right === false) { |
|
| 1070 | $result = $this->getNodeBehavior()->getParent() |
|
| 1071 | ->select([$this->leftAttribute, $this->rightAttribute]) |
|
| 1072 | ->createCommand() |
|
| 1073 | ->queryOne(); |
|
| 1074 | $right = $result[$this->rightAttribute]; |
|
| 1075 | } |
|
| 1076 | $right = (int)$right; |
|
| 1077 | return $result; |
|
| 1078 | } |
|
| 1079 | ||
| 1080 | /** |
|
| 1081 | * @param int $value |
|