/** * @param int $eventType * @param string $eventObjectClassName core class name * @param int $partnerId * @return array<EventNotificationTemplate> */ public static function getNotificationTemplates($eventType, $eventObjectClassName, $partnerId) { if (is_null(self::$allNotificationTemplates)) { self::$allNotificationTemplates = EventNotificationTemplatePeer::retrieveByPartnerId($partnerId); KalturaLog::debug("Found [" . count(self::$allNotificationTemplates) . "] templates"); } $notificationTemplates = array(); foreach (self::$allNotificationTemplates as $notificationTemplate) { /* @var $notificationTemplate EventNotificationTemplate */ if (!$notificationTemplate->getAutomaticDispatchEnabled()) { continue; } if ($notificationTemplate->getEventType() != $eventType) { continue; } $templateObjectClassName = KalturaPluginManager::getObjectClass('EventNotificationEventObjectType', $notificationTemplate->getObjectType()); if (strcmp($eventObjectClassName, $templateObjectClassName) && !is_subclass_of($eventObjectClassName, $templateObjectClassName)) { continue; } $notificationTemplates[] = $notificationTemplate; } return $notificationTemplates; }
/** * @param int $eventType * @param int $eventObjectType * @param int $partnerId * @return array<EventNotificationTemplate> */ public static function getNotificationTemplates($eventType, $eventObjectType, $partnerId) { if (is_null(self::$allNotificationTemplates)) { self::$allNotificationTemplates = EventNotificationTemplatePeer::retrieveByPartnerId($partnerId); KalturaLog::debug("Found [" . count(self::$allNotificationTemplates) . "] templates"); } $notificationTemplates = array(); foreach (self::$allNotificationTemplates as $notificationTemplate) { /* @var $notificationTemplate EventNotificationTemplate */ if ($notificationTemplate->getEventType() == $eventType && $notificationTemplate->getObjectType() == $eventObjectType && $notificationTemplate->getAutomaticDispatchEnabled()) { $notificationTemplates[] = $notificationTemplate; } } return $notificationTemplates; }