1 | <?php declare(strict_types = 1); |
||
2 | |||
3 | /** |
||
4 | * Created by PhpStorm. |
||
5 | * User: gordon |
||
6 | * Date: 25/3/2561 |
||
7 | * Time: 17:01 น. |
||
8 | */ |
||
9 | |||
10 | namespace Suilven\FreeTextSearch\QueuedJob; |
||
11 | |||
12 | use Suilven\FreeTextSearch\Helper\BulkIndexingHelper; |
||
13 | use Symbiote\QueuedJobs\Services\AbstractQueuedJob; |
||
14 | |||
15 | class BulkIndexDirtyJob extends AbstractQueuedJob |
||
16 | { |
||
17 | |||
18 | // variable $indexName cannot be declared here, because serialization of the job does not store this variable |
||
19 | |||
20 | public function getTitle(): string |
||
21 | { |
||
22 | return 'Bulk Index Dirty DataObjects'; |
||
23 | } |
||
24 | |||
25 | |||
26 | /** @param string $newIndexName the name of the index */ |
||
27 | public function hydrate(string $newIndexName): void |
||
28 | { |
||
29 | // @phpstan-ignore-next-line |
||
30 | $this->indexName = $newIndexName; |
||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
![]() |
|||
31 | } |
||
32 | |||
33 | |||
34 | public function setup(): void |
||
35 | { |
||
36 | $this->totalSteps = 1; |
||
37 | } |
||
38 | |||
39 | |||
40 | public function process(): void |
||
41 | { |
||
42 | $helper = new BulkIndexingHelper(); |
||
43 | |||
44 | // @phpstan-ignore-next-line |
||
45 | $helper->bulkIndex($this->indexName, true); |
||
46 | |||
47 | $this->isComplete = true; |
||
48 | } |
||
49 | } |
||
50 |