Skip to content

Commit ef3d8df

Browse files
authored
refactor: remove deprecated code (#7778)
1 parent 465f6b7 commit ef3d8df

3 files changed

Lines changed: 0 additions & 43 deletions

File tree

‎src/Query/Builder.php‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -410,22 +410,6 @@ public function from($table)
410410
return $this;
411411
}
412412

413-
/**
414-
* Set the force indexes which the query should be used.
415-
* @deprecated It will be removed in v3.1, please use `forceIndex` instead
416-
*/
417-
public function forceIndexes(array $forceIndexes): static
418-
{
419-
$values = [];
420-
foreach ($forceIndexes as $forceIndex) {
421-
$values[] = '`' . str_replace('`', '``', $forceIndex) . '`';
422-
}
423-
424-
$this->indexHint = new IndexHint('force', implode(',', $values));
425-
426-
return $this;
427-
}
428-
429413
/**
430414
* Add an index hint to suggest a query index.
431415
*/

‎tests/DatabaseQueryBuilderTest.php‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -252,24 +252,15 @@ public function testForceIndex(): void
252252
{
253253
$builder = $this->getMySqlBuilder();
254254
$builder1 = (clone $builder)->select('*')->from('users')->where('username', 'xxx')->forceIndex('index1');
255-
$foeceses = (clone $builder)->select('*')->from('users')->where('username', 'xxx')->forceIndexes(['index1']);
256-
257255
$this->assertSame('select * from `users` force index (index1) where `username` = ?', $builder1->toSql());
258-
$this->assertSame('select * from `users` force index (`index1`) where `username` = ?', $foeceses->toSql());
259256

260257
$builder2 = (clone $builder);
261258
$builder2->select('*')->from('users')->where('username', 'xxx')->forceIndex('index2');
262-
$foeceses = (clone $builder);
263-
$foeceses->select('*')->from('users')->where('username', 'xxx')->forceIndexes(['index2']);
264259
$this->assertSame('select * from `users` force index (index2) where `username` = ?', $builder2->toSql());
265-
$this->assertSame('select * from `users` force index (`index2`) where `username` = ?', $foeceses->toSql());
266260

267261
$builder3 = (clone $builder);
268-
$foeceses = (clone $builder);
269262
$builder3->select('*')->from('users')->where('username', 'xxx')->forceIndex('index1,index2');
270-
$foeceses->select('*')->from('users')->where('username', 'xxx')->forceIndexes(['index1', 'index2']);
271263
$this->assertSame('select * from `users` force index (index1,index2) where `username` = ?', $builder3->toSql());
272-
$this->assertSame('select * from `users` force index (`index1`,`index2`) where `username` = ?', $foeceses->toSql());
273264
}
274265

275266
public function testIgnoreIndex(): void

‎tests/ModelRealBuilderTest.php‎

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -243,24 +243,6 @@ public function testUserWhereBit()
243243
}
244244
}
245245

246-
public function testForceIndexes()
247-
{
248-
$this->getContainer();
249-
250-
User::query()->get();
251-
User::query()->forceIndexes(['PRIMARY'])->where('id', '>', 1)->get();
252-
253-
$sqls = [
254-
['select * from `user`', []],
255-
['select * from `user` force index (`PRIMARY`) where `id` > ?', [1]],
256-
];
257-
while ($event = $this->channel->pop(0.001)) {
258-
if ($event instanceof QueryExecuted) {
259-
$this->assertSame([$event->sql, $event->bindings], array_shift($sqls));
260-
}
261-
}
262-
}
263-
264246
public function testIncrement()
265247
{
266248
$this->getContainer();

0 commit comments

Comments
 (0)