|
2 | 2 |
|
3 | 3 | namespace SQLParser\Node;
|
4 | 4 |
|
5 |
| -use Doctrine\DBAL\Connection; |
| 5 | +use Doctrine\DBAL\Platforms\AbstractPlatform; |
| 6 | + |
6 | 7 | use Mouf\MoufManager;
|
7 | 8 | use Mouf\MoufInstanceDescriptor;
|
8 | 9 | use Mouf\Utils\Common\ConditionInterface\ConditionInterface;
|
@@ -145,14 +146,15 @@ public function toInstanceDescriptor(MoufManager $moufManager)
|
145 | 146 | /**
|
146 | 147 | * Renders the object as a SQL string.
|
147 | 148 | *
|
148 |
| - * @param Connection $dbConnection |
149 |
| - * @param array $parameters |
150 |
| - * @param number $indent |
151 |
| - * @param int $conditionsMode |
| 149 | + * @param array $parameters |
| 150 | + * @param AbstractPlatform $platform |
| 151 | + * @param int $indent |
| 152 | + * @param int $conditionsMode |
152 | 153 | *
|
| 154 | + * @param bool $extrapolateParameters |
153 | 155 | * @return string
|
154 | 156 | */
|
155 |
| - public function toSql(array $parameters = array(), Connection $dbConnection = null, $indent = 0, $conditionsMode = self::CONDITION_APPLY, bool $extrapolateParameters = true) |
| 157 | + public function toSql(array $parameters, AbstractPlatform $platform, $indent = 0, $conditionsMode = self::CONDITION_APPLY, bool $extrapolateParameters = true): ?string |
156 | 158 | {
|
157 | 159 | $minBypass = false;
|
158 | 160 | $maxBypass = false;
|
@@ -182,19 +184,19 @@ public function toSql(array $parameters = array(), Connection $dbConnection = nu
|
182 | 184 | }
|
183 | 185 |
|
184 | 186 | if (!$minBypass && !$maxBypass) {
|
185 |
| - $sql = NodeFactory::toSql($this->leftOperand, $dbConnection, $parameters, ' ', false, $indent, $conditionsMode, $extrapolateParameters); |
| 187 | + $sql = NodeFactory::toSql($this->leftOperand, $platform, $parameters, ' ', false, $indent, $conditionsMode, $extrapolateParameters); |
186 | 188 | $sql .= ' BETWEEN ';
|
187 |
| - $sql .= NodeFactory::toSql($this->minValueOperand, $dbConnection, $parameters, ' ', false, $indent, $conditionsMode, $extrapolateParameters); |
| 189 | + $sql .= NodeFactory::toSql($this->minValueOperand, $platform, $parameters, ' ', false, $indent, $conditionsMode, $extrapolateParameters); |
188 | 190 | $sql .= ' AND ';
|
189 |
| - $sql .= NodeFactory::toSql($this->maxValueOperand, $dbConnection, $parameters, ' ', false, $indent, $conditionsMode, $extrapolateParameters); |
| 191 | + $sql .= NodeFactory::toSql($this->maxValueOperand, $platform, $parameters, ' ', false, $indent, $conditionsMode, $extrapolateParameters); |
190 | 192 | } elseif (!$minBypass && $maxBypass) {
|
191 |
| - $sql = NodeFactory::toSql($this->leftOperand, $dbConnection, $parameters, ' ', false, $indent, $conditionsMode, $extrapolateParameters); |
| 193 | + $sql = NodeFactory::toSql($this->leftOperand, $platform, $parameters, ' ', false, $indent, $conditionsMode, $extrapolateParameters); |
192 | 194 | $sql .= ' >= ';
|
193 |
| - $sql .= NodeFactory::toSql($this->minValueOperand, $dbConnection, $parameters, ' ', false, $indent, $conditionsMode, $extrapolateParameters); |
| 195 | + $sql .= NodeFactory::toSql($this->minValueOperand, $platform, $parameters, ' ', false, $indent, $conditionsMode, $extrapolateParameters); |
194 | 196 | } elseif ($minBypass && !$maxBypass) {
|
195 |
| - $sql = NodeFactory::toSql($this->leftOperand, $dbConnection, $parameters, ' ', false, $indent, $conditionsMode, $extrapolateParameters); |
| 197 | + $sql = NodeFactory::toSql($this->leftOperand, $platform, $parameters, ' ', false, $indent, $conditionsMode, $extrapolateParameters); |
196 | 198 | $sql .= ' <= ';
|
197 |
| - $sql .= NodeFactory::toSql($this->maxValueOperand, $dbConnection, $parameters, ' ', false, $indent, $conditionsMode, $extrapolateParameters); |
| 199 | + $sql .= NodeFactory::toSql($this->maxValueOperand, $platform, $parameters, ' ', false, $indent, $conditionsMode, $extrapolateParameters); |
198 | 200 | } else {
|
199 | 201 | $sql = null;
|
200 | 202 | }
|
|
0 commit comments