| Conditions | 2 |
| Paths | 4 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | public function run(array $payload, array $options = []): bool |
||
| 36 | { |
||
| 37 | $handler = new CollectionHandler(); |
||
| 38 | try { |
||
| 39 | /** @var \BEdita\Core\Model\Entity\ObjectEntity $collection */ |
||
| 40 | $collection = $this->fetchTable('Collections')->get($payload['collection_id']); |
||
| 41 | /** @var \BEdita\Core\Model\Entity\ObjectEntity $file */ |
||
| 42 | $file = $this->fetchTable('Files')->get($payload['file_id']); |
||
| 43 | $handler->uploadDocument($collection, $file); |
||
| 44 | |||
| 45 | return true; |
||
| 46 | } catch (Throwable $th) { |
||
| 47 | $this->log(sprintf('IndexFile async job error - %s', $th->getMessage()), 'error'); |
||
| 48 | } |
||
| 49 | |||
| 50 | return false; |
||
| 51 | } |
||
| 53 |