17 private static $keys = [
'fields',
'external_fields',
'actions'];
21 $this->entity = $entity;
23 parent::__construct(
'catalog', self::makeEventName(get_class($this->entity), $type),
$parameters);
38 foreach($this->getResults() as $eventResult)
40 if ($eventResult->getType() === Main\
Entity\EventResult::ERROR)
43 $result->addErrors($eventResult->getErrors());
55 public function mergeData(array &$data): void
58 foreach($this->getResults() as $eventResult)
60 $removed = $eventResult->getUnset();
61 foreach (self::$keys as $index)
63 if (empty($removed[$index]))
65 foreach ($removed[$index] as $key)
66 unset($data[$index][$key]);
70 $modified = $eventResult->getModified();
71 foreach (self::$keys as $index)
73 if (empty($modified[$index]))
75 $data[$index] = array_merge($data[$index], $modified[$index]);
90 return static::existEventHandlersById(self::makeEventName(get_class($entity), $eventName));
98 public static function makeEventName(
string $class,
string $eventName): string
100 return $class.
'::'.$eventName;
111 if (!isset(self::$catalogHandlerExist[$id]))
113 $eventManager = Main\EventManager::getInstance();
114 $eventsList = $eventManager->findEventHandlers(
117 self::$catalogHandlerExist[$id] = !empty($eventsList);
118 unset($eventsList, $eventManager);
120 return self::$catalogHandlerExist[$id];
static loadMessages($file)