tomasnorre/crawler

Switch to EventListeners internally

tomasnorre opened this issue · 0 comments

There are some places in the Crawler code, which isn't using the full potential of the EventDispatcher/Listerner approach.

The part below comment should be extracted, and handled in a listener.

e.g.

/** @var AfterQueueItemAddedEvent $event */
$event = $this->eventDispatcher->dispatch(new AfterQueueItemAddedEvent($queueId, $field_array));
$field_array = $event->getFieldArray();

//This should be extracted, we should listen to the event ourself,
// and move the code block here to an appropiate place. /Tomas 2024-10-07
GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable(QueueRepository::TABLE_NAME)->update(
    QueueRepository::TABLE_NAME, $field_array, 
    ['qid' => (int) $queueId]);

There is more likely other places like this that needs refactor.