|
49 | 49 | use function count; |
50 | 50 | use function property_exists; |
51 | 51 | use function sprintf; |
| 52 | +use function strpos; |
52 | 53 | use function version_compare; |
53 | 54 | use const PHP_VERSION_ID; |
54 | 55 |
|
@@ -1176,37 +1177,41 @@ public function getTestData(): iterable |
1176 | 1177 | ', |
1177 | 1178 | ]; |
1178 | 1179 |
|
1179 | | - yield 'date_add function' => [ |
1180 | | - $this->constantArray([ |
1181 | | - [new ConstantIntegerType(1), new StringType()], |
1182 | | - [new ConstantIntegerType(2), TypeCombinator::addNull(new StringType())], |
1183 | | - [new ConstantIntegerType(3), TypeCombinator::addNull(new StringType())], |
1184 | | - [new ConstantIntegerType(4), new StringType()], |
1185 | | - ]), |
1186 | | - ' |
| 1180 | + $ormVersion = InstalledVersions::getVersion('doctrine/orm'); |
| 1181 | + $hasOrm3 = strpos($ormVersion, '3.0') === 0; |
| 1182 | + if (!$hasOrm3) { |
| 1183 | + yield 'date_add function' => [ |
| 1184 | + $this->constantArray([ |
| 1185 | + [new ConstantIntegerType(1), new StringType()], |
| 1186 | + [new ConstantIntegerType(2), TypeCombinator::addNull(new StringType())], |
| 1187 | + [new ConstantIntegerType(3), TypeCombinator::addNull(new StringType())], |
| 1188 | + [new ConstantIntegerType(4), new StringType()], |
| 1189 | + ]), |
| 1190 | + ' |
1187 | 1191 | SELECT DATE_ADD(m.datetimeColumn, m.intColumn, \'day\'), |
1188 | 1192 | DATE_ADD(m.stringNullColumn, m.intColumn, \'day\'), |
1189 | 1193 | DATE_ADD(m.datetimeColumn, NULLIF(m.intColumn, 1), \'day\'), |
1190 | 1194 | DATE_ADD(\'2020-01-01\', 7, \'day\') |
1191 | 1195 | FROM QueryResult\Entities\Many m |
1192 | 1196 | ', |
1193 | | - ]; |
| 1197 | + ]; |
1194 | 1198 |
|
1195 | | - yield 'date_sub function' => [ |
1196 | | - $this->constantArray([ |
1197 | | - [new ConstantIntegerType(1), new StringType()], |
1198 | | - [new ConstantIntegerType(2), TypeCombinator::addNull(new StringType())], |
1199 | | - [new ConstantIntegerType(3), TypeCombinator::addNull(new StringType())], |
1200 | | - [new ConstantIntegerType(4), new StringType()], |
1201 | | - ]), |
1202 | | - ' |
| 1199 | + yield 'date_sub function' => [ |
| 1200 | + $this->constantArray([ |
| 1201 | + [new ConstantIntegerType(1), new StringType()], |
| 1202 | + [new ConstantIntegerType(2), TypeCombinator::addNull(new StringType())], |
| 1203 | + [new ConstantIntegerType(3), TypeCombinator::addNull(new StringType())], |
| 1204 | + [new ConstantIntegerType(4), new StringType()], |
| 1205 | + ]), |
| 1206 | + ' |
1203 | 1207 | SELECT DATE_SUB(m.datetimeColumn, m.intColumn, \'day\'), |
1204 | 1208 | DATE_SUB(m.stringNullColumn, m.intColumn, \'day\'), |
1205 | 1209 | DATE_SUB(m.datetimeColumn, NULLIF(m.intColumn, 1), \'day\'), |
1206 | 1210 | DATE_SUB(\'2020-01-01\', 7, \'day\') |
1207 | 1211 | FROM QueryResult\Entities\Many m |
1208 | 1212 | ', |
1209 | | - ]; |
| 1213 | + ]; |
| 1214 | + } |
1210 | 1215 |
|
1211 | 1216 | yield 'date_diff function' => [ |
1212 | 1217 | $this->constantArray([ |
|
0 commit comments