public static function loadObject($baseClass, $enumValue, array $constructorArgs = null)
 {
     if ($baseClass == 'ISyncableFile' && $enumValue == self::getEmailNotificationFileSyncObjectTypeCoreValue(EmailNotificationFileSyncObjectType::EMAIL_NOTIFICATION_TEMPLATE) && isset($constructorArgs['objectId'])) {
         return EventNotificationTemplatePeer::retrieveTypeByPK(self::getEmailNotificationTemplateTypeCoreValue(EmailNotificationTemplateType::EMAIL), $constructorArgs['objectId']);
     }
     if ($baseClass == 'KEmailNotificationRecipientEngine') {
         list($recipientJobData, $kClient) = $constructorArgs;
         switch ($enumValue) {
             case KalturaEmailNotificationRecipientProviderType::CATEGORY:
                 return new KEmailNotificationCategoryRecipientEngine($recipientJobData, $kClient);
                 break;
             case KalturaEmailNotificationRecipientProviderType::STATIC_LIST:
                 return new KEmailNotificationStaticRecipientEngine($recipientJobData, $kClient);
                 break;
             case KalturaEmailNotificationRecipientProviderType::USER:
                 return new KEmailNotificationUserRecipientEngine($recipientJobData, $kClient);
                 break;
         }
     }
     $class = self::getObjectClass($baseClass, $enumValue);
     if ($class) {
         if (is_array($constructorArgs)) {
             $reflect = new ReflectionClass($class);
             return $reflect->newInstanceArgs($constructorArgs);
         }
         return new $class();
     }
     return null;
 }
 /**
  * @param Partner $fromPartner
  * @param Partner $toPartner
  */
 protected function copyEventNotificationTemplates(Partner $fromPartner, Partner $toPartner, $permissionRequiredOnly = false)
 {
     $fromPartnerId = $fromPartner->getId();
     $toPartnerId = $toPartner->getId();
     KalturaLog::debug("Copy event-notification templates from [{$fromPartnerId}] to [{$toPartnerId}]");
     $c = new Criteria();
     $c->add(EventNotificationTemplatePeer::PARTNER_ID, $fromPartnerId);
     $systemNameCriteria = new Criteria();
     $systemNameCriteria->add(EventNotificationTemplatePeer::PARTNER_ID, $toPartnerId);
     $systemNameCriteria->add(EventNotificationTemplatePeer::STATUS, EventNotificationTemplateStatus::ACTIVE);
     $eventNotificationTemplates = EventNotificationTemplatePeer::doSelect($c);
     foreach ($eventNotificationTemplates as $eventNotificationTemplate) {
         /* @var $eventNotificationTemplate EventNotificationTemplate */
         if ($permissionRequiredOnly && !count($eventNotificationTemplate->getRequiredCopyTemplatePermissions())) {
             continue;
         }
         if (!myPartnerUtils::isPartnerPermittedForCopy($toPartner, $eventNotificationTemplate->getRequiredCopyTemplatePermissions())) {
             continue;
         }
         if ($eventNotificationTemplate->getSystemName()) {
             $c = clone $systemNameCriteria;
             $c->add(EventNotificationTemplatePeer::SYSTEM_NAME, $eventNotificationTemplate->getSystemName());
             if (EventNotificationTemplatePeer::doCount($c)) {
                 continue;
             }
         }
         $newEventNotificationTemplate = $eventNotificationTemplate->copy();
         $newEventNotificationTemplate->setPartnerId($toPartnerId);
         $newEventNotificationTemplate->save();
     }
 }
 public function getData(kHttpNotificationDispatchJobData $jobData = null)
 {
     $coreObject = unserialize($this->coreObject);
     $apiObject = new $this->apiObjectType();
     /* @var $apiObject KalturaObject */
     $apiObject->fromObject($coreObject);
     $httpNotificationTemplate = EventNotificationTemplatePeer::retrieveByPK($jobData->getTemplateId());
     $notification = new KalturaHttpNotification();
     $notification->object = $apiObject;
     $notification->eventObjectType = kPluginableEnumsManager::coreToApi('EventNotificationEventObjectType', $httpNotificationTemplate->getObjectType());
     $notification->eventNotificationJobId = $jobData->getJobId();
     $notification->templateId = $httpNotificationTemplate->getId();
     $notification->templateName = $httpNotificationTemplate->getName();
     $notification->templateSystemName = $httpNotificationTemplate->getSystemName();
     $notification->eventType = $httpNotificationTemplate->getEventType();
     $data = '';
     switch ($this->format) {
         case KalturaResponseType::RESPONSE_TYPE_XML:
             $serializer = new KalturaXmlSerializer($this->ignoreNull);
             $data = '<notification>' . $serializer->serialize($notification) . '</notification>';
             break;
         case KalturaResponseType::RESPONSE_TYPE_PHP:
             $serializer = new KalturaPhpSerializer($this->ignoreNull);
             $data = $serializer->serialize($notification);
             break;
         case KalturaResponseType::RESPONSE_TYPE_JSON:
             $serializer = new KalturaJsonSerializer($this->ignoreNull);
             $data = $serializer->serialize($notification);
             break;
     }
     return "data={$data}";
 }
 public function validateForUsage($sourceObject, $propertiesToSkip = array())
 {
     parent::validateForUsage($sourceObject, $propertiesToSkip);
     $this->validatePropertyNotNull('eventNotificationTemplateId');
     myPartnerUtils::addPartnerToCriteria('EventNotificationTemplate', kCurrentContext::getCurrentPartnerId(), true);
     $eventNotificationTemplate = EventNotificationTemplatePeer::retrieveByPK($this->eventNotificationTemplateId);
     if (is_null($eventNotificationTemplate)) {
         throw new KalturaAPIException(KalturaEventNotificationErrors::EVENT_NOTIFICATION_TEMPLATE_NOT_FOUND, $this->eventNotificationTemplateId);
     }
 }
 /**
  * Register to a queue from which event messages will be provided according to given template. Queue will be created if not already exists
  * 
  * @action register
  * @actionAlias eventNotification_eventNotificationTemplate.register
  * @param string $notificationTemplateSystemName Existing push notification template system name
  * @param KalturaEventNotificationParameterArray $userParamsArray User params
  * @return KalturaPushNotificationData
  */
 function registerAction($notificationTemplateSystemName, $userParamsArray)
 {
     // find the template, according to its system name, on both current partner and partner 0
     $partnerId = $this->getPartnerId();
     $partnersIds = array(PartnerPeer::GLOBAL_PARTNER, $partnerId);
     $dbEventNotificationTemplate = EventNotificationTemplatePeer::retrieveBySystemName($notificationTemplateSystemName, null, $partnersIds);
     if (!$dbEventNotificationTemplate) {
         throw new KalturaAPIException(KalturaEventNotificationErrors::EVENT_NOTIFICATION_TEMPLATE_SYSTEM_NAME_NOT_FOUND, $notificationTemplateSystemName);
     }
     // verify template is push typed
     if (!$dbEventNotificationTemplate instanceof PushNotificationTemplate) {
         throw new KalturaAPIException(KalturaEventNotificationErrors::EVENT_NOTIFICATION_WRONG_TYPE, $notificationTemplateSystemName, get_class($dbEventNotificationTemplate));
     }
     // Check all template needed params were actually given
     $missingParams = array();
     $templateParams = $dbEventNotificationTemplate->getContentParameters();
     // create array of all keys
     $userParamsArrayKeys = array();
     foreach ($userParamsArray as $userParam) {
         array_push($userParamsArrayKeys, $userParam->toObject()->getKey());
     }
     foreach ($templateParams as $templateParam) {
         if (!in_array($templateParam->getKey(), $userParamsArrayKeys)) {
             array_push($missingParams, $templateParam->getKey());
         }
     }
     if ($missingParams != null) {
         throw new KalturaAPIException(KalturaErrors::MISSING_MANDATORY_PARAMETER, implode(",", $missingParams));
     }
     //check that keys actually have values
     foreach ($userParamsArray as $userParam) {
         $userParamObj = $userParam->toObject();
         if (!$userParamObj->getValue()) {
             KalturaLog::debug(print_r($userParamObj, true));
             throw new KalturaAPIException(KalturaErrors::MISSING_MANDATORY_PARAMETER, "Value of " . $userParamObj->getKey());
         }
     }
     $queueKey = $dbEventNotificationTemplate->getQueueKey($userParamsArray->toObjectsArray(), $partnerId, null);
     $hash = kCurrentContext::$ks_object->getHash();
     // create queue if not exists
     if (!$dbEventNotificationTemplate->exists($queueKey)) {
         $dbEventNotificationTemplate->create($queueKey);
     }
     $result = new KalturaPushNotificationData();
     $result->key = $this->encode($queueKey . ":" . $hash);
     // build the url to return
     $protocol = infraRequestUtils::getProtocol();
     $host = kConf::get("push_server_host");
     $secret = kConf::get("push_server_secret");
     $ip = kCurrentContext::$user_ip;
     $token = base64_encode($partnerId . ":" . $this->encode($secret . ":" . $ip . ":" . $hash . ":" . uniqid()));
     $result->url = $protocol . "://" . $host . "/?p=" . $partnerId . "&x=" . urlencode($token);
     return $result;
 }
 /**
  * @return the $caseId
  */
 public function getCaseId()
 {
     if ($this->caseId) {
         return $this->caseId;
     }
     $template = EventNotificationTemplatePeer::retrieveByPK($this->getTemplateId());
     /* @var $template BusinessProcessNotificationTemplate */
     $object = $this->getObject();
     if ($template && $object) {
         $cases = $template->getCaseIds($object);
         return end($cases);
     }
 }
 public function updatedJob(BatchJob $dbBatchJob)
 {
     $data = $dbBatchJob->getData();
     /* @var $data kIntegrationJobData */
     $triggerData = $data->getTriggerData();
     /* @var $triggerData kBpmEventNotificationIntegrationJobTriggerData */
     $template = EventNotificationTemplatePeer::retrieveByPK($triggerData->getTemplateId());
     /* @var $template BusinessProcessNotificationTemplate */
     $object = $dbBatchJob->getObject();
     if ($object) {
         $template->addCaseId($object, $triggerData->getCaseId(), $triggerData->getBusinessProcessId());
     }
     return true;
 }
Пример #8
0
 public static function loadObject($baseClass, $enumValue, array $constructorArgs = null)
 {
     if ($baseClass == 'ISyncableFile' && $enumValue == self::getHttpNotificationFileSyncObjectTypeCoreValue(HttpNotificationFileSyncObjectType::HTTP_NOTIFICATION_TEMPLATE) && isset($constructorArgs['objectId'])) {
         return EventNotificationTemplatePeer::retrieveTypeByPK(self::getHttpNotificationTemplateTypeCoreValue(HttpNotificationTemplateType::HTTP), $constructorArgs['objectId']);
     }
     $class = self::getObjectClass($baseClass, $enumValue);
     if ($class) {
         if (is_array($constructorArgs)) {
             $reflect = new ReflectionClass($class);
             return $reflect->newInstanceArgs($constructorArgs);
         }
         return new $class();
     }
     return null;
 }
 public function objectDeleted(BaseObject $object, BatchJob $raisedJob = null)
 {
     $scope = new kEventNotificationScope();
     $scope->setObject($object);
     if ($raisedJob) {
         $scope->setParentRaisedJob($raisedJob);
     }
     $templateIds = BusinessProcessNotificationTemplate::getCaseTemplatesIds($object);
     foreach ($templateIds as $templateId) {
         $notificationTemplate = EventNotificationTemplatePeer::retrieveByPK($templateId);
         /* @var $notificationTemplate BusinessProcessStartNotificationTemplate */
         if ($notificationTemplate->getStatus() != EventNotificationTemplateStatus::ACTIVE || !$notificationTemplate->getAbortOnDeletion()) {
             continue;
         }
         if ($notificationTemplate->getPartnerId()) {
             $scope->setPartnerId($notificationTemplate->getPartnerId());
         }
         $notificationTemplate->abort($scope);
     }
     return true;
 }
 /**
  * Retrieve event notification templates according to systemName
  * @param string $systemName
  * @param int $excludeId
  * @param PropelPDO $con
  * @return array<EventNotificationTemplate>
  */
 public static function retrieveBySystemName($systemName, $excludeId = null, PropelPDO $con = null)
 {
     $criteria = new Criteria(EventNotificationTemplatePeer::DATABASE_NAME);
     $criteria->add(EventNotificationTemplatePeer::STATUS, EventNotificationTemplateStatus::ACTIVE);
     $criteria->add(EventNotificationTemplatePeer::SYSTEM_NAME, $systemName);
     if ($excludeId) {
         $criteria->add(EventNotificationTemplatePeer::ID, $excludeId, Criteria::NOT_EQUAL);
     }
     $criteria->add(EventNotificationTemplatePeer::PARTNER_ID, kCurrentContext::getCurrentPartnerId());
     return EventNotificationTemplatePeer::doSelect($criteria);
 }
 /**
  * Builds a Criteria object containing the primary key for this object.
  *
  * Unlike buildCriteria() this method includes the primary key values regardless
  * of whether or not they have been modified.
  *
  * @return     Criteria The Criteria object containing value(s) for primary key(s).
  */
 public function buildPkeyCriteria()
 {
     $criteria = new Criteria(EventNotificationTemplatePeer::DATABASE_NAME);
     $criteria->add(EventNotificationTemplatePeer::ID, $this->id);
     if ($this->alreadyInSave && count($this->modifiedColumns) == 2 && $this->isColumnModified(EventNotificationTemplatePeer::UPDATED_AT)) {
         $theModifiedColumn = null;
         foreach ($this->modifiedColumns as $modifiedColumn) {
             if ($modifiedColumn != EventNotificationTemplatePeer::UPDATED_AT) {
                 $theModifiedColumn = $modifiedColumn;
             }
         }
         $atomicColumns = EventNotificationTemplatePeer::getAtomicColumns();
         if (in_array($theModifiedColumn, $atomicColumns)) {
             $criteria->add($theModifiedColumn, $this->getByName($theModifiedColumn, BasePeer::TYPE_COLNAME), Criteria::NOT_EQUAL);
         }
     }
     return $criteria;
 }
 public static function cleanMemory()
 {
     EventNotificationTemplatePeer::clearInstancePool();
 }
 /**
  * @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;
 }
 /**
  * Action lists the template partner event notification templates.
  * @action listTemplates
  * 
  * @param KalturaEventNotificationTemplateFilter $filter
  * @param KalturaFilterPager $pager
  * @return KalturaEventNotificationTemplateListResponse
  */
 public function listTemplatesAction(KalturaEventNotificationTemplateFilter $filter = null, KalturaFilterPager $pager = null)
 {
     if (!$filter) {
         $filter = new KalturaEventNotificationTemplateFilter();
     }
     if (!$pager) {
         $pager = new KalturaFilterPager();
     }
     $coreFilter = new EventNotificationTemplateFilter();
     $filter->toObject($coreFilter);
     $criteria = new Criteria();
     $coreFilter->attachToCriteria($criteria);
     $criteria->add(EventNotificationTemplatePeer::PARTNER_ID, PartnerPeer::GLOBAL_PARTNER);
     $count = EventNotificationTemplatePeer::doCount($criteria);
     $pager->attachToCriteria($criteria);
     $results = EventNotificationTemplatePeer::doSelect($criteria);
     $response = new KalturaEventNotificationTemplateListResponse();
     $response->objects = KalturaEventNotificationTemplateArray::fromDbArray($results, $this->getResponseProfile());
     $response->totalCount = $count;
     return $response;
 }
 protected function validate(EventNotificationTemplate $sourceObject = null)
 {
     $this->validatePropertyMinLength('systemName', 3, true);
     $id = null;
     if ($sourceObject) {
         $id = $sourceObject->getId();
     }
     if (trim($this->systemName) && !$this->isNull('systemName')) {
         $systemNameTemplates = EventNotificationTemplatePeer::retrieveBySystemName($this->systemName, $id);
         if (count($systemNameTemplates)) {
             throw new KalturaAPIException(KalturaEventNotificationErrors::EVENT_NOTIFICATION_TEMPLATE_DUPLICATE_SYSTEM_NAME, $this->systemName);
         }
     }
 }
 protected function getFieldNameFromPeer($field_name)
 {
     $res = EventNotificationTemplatePeer::translateFieldName($field_name, $this->field_name_translation_type, BasePeer::TYPE_COLNAME);
     return $res;
 }
 /**
  * @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;
 }
 /**
  * Retrieve multiple objects by pkey.
  *
  * @param      array $pks List of primary keys
  * @param      PropelPDO $con the connection to use
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function retrieveByPKs($pks, PropelPDO $con = null)
 {
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(EventNotificationTemplatePeer::DATABASE_NAME);
         $criteria->add(EventNotificationTemplatePeer::ID, $pks, Criteria::IN);
         $objs = EventNotificationTemplatePeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Пример #19
0
 /**
  * list business-process cases
  * 
  * @action list
  * @param KalturaEventNotificationEventObjectType $objectType
  * @param string $objectId
  * @return KalturaBusinessProcessCaseArray
  * 
  * @throws KalturaBusinessProcessNotificationErrors::BUSINESS_PROCESS_CASE_NOT_FOUND
  * @throws KalturaBusinessProcessNotificationErrors::BUSINESS_PROCESS_SERVER_NOT_FOUND
  */
 public function listAction($objectType, $objectId)
 {
     $dbObject = kEventNotificationFlowManager::getObject($objectType, $objectId);
     if (!$dbObject) {
         throw new KalturaAPIException(KalturaErrors::OBJECT_NOT_FOUND);
     }
     $templatesIds = BusinessProcessNotificationTemplate::getCaseTemplatesIds($dbObject);
     if (!count($templatesIds)) {
         throw new KalturaAPIException(KalturaBusinessProcessNotificationErrors::BUSINESS_PROCESS_CASE_NOT_FOUND);
     }
     $array = new KalturaBusinessProcessCaseArray();
     foreach ($templatesIds as $templateId) {
         $dbTemplate = EventNotificationTemplatePeer::retrieveByPK($templateId);
         if (!$dbTemplate || !$dbTemplate instanceof BusinessProcessStartNotificationTemplate) {
             KalturaLog::info("Template [{$templateId}] not found");
             continue;
         }
         $caseIds = $dbTemplate->getCaseIds($dbObject, false);
         if (!count($caseIds)) {
             KalturaLog::info("No cases found");
             continue;
         }
         $dbBusinessProcessServer = BusinessProcessServerPeer::retrieveByPK($dbTemplate->getServerId());
         if (!$dbBusinessProcessServer) {
             KalturaLog::info("Business-Process server [" . $dbTemplate->getServerId() . "] not found");
             continue;
         }
         $businessProcessServer = KalturaBusinessProcessServer::getInstanceByType($dbBusinessProcessServer->getType());
         $businessProcessServer->fromObject($dbBusinessProcessServer);
         $provider = kBusinessProcessProvider::get($businessProcessServer);
         if (!$provider) {
             KalturaLog::info("Provider [" . $businessProcessServer->type . "] not found");
             continue;
         }
         foreach ($caseIds as $caseId) {
             try {
                 $case = $provider->getCase($caseId);
                 $businessProcessCase = new KalturaBusinessProcessCase();
                 $businessProcessCase->businessProcessStartNotificationTemplateId = $templateId;
                 $businessProcessCase->fromObject($case);
                 $array[] = $businessProcessCase;
             } catch (ActivitiClientException $e) {
                 KalturaLog::err("Case [{$caseId}] not found: " . $e->getMessage());
             }
         }
     }
     return $array;
 }
$criteria->add(EventNotificationTemplatePeer::STATUS, EventNotificationTemplateStatus::DELETED, Criteria::NOT_EQUAL);
$criteria->add(EventNotificationTemplatePeer::SYSTEM_NAME, array('New_Item_Pending_Moderation', 'New_Item_Pending_Moderation_2', 'Entry_Was_Added_To_Channel'), Criteria::IN);
$criteria->addAscendingOrderByColumn(EventNotificationTemplatePeer::ID);
$criteria->setLimit(100);
$eventNotificationTemplates = EventNotificationTemplatePeer::doSelect($criteria);
$lastId = 0;
$count = 0;
while ($eventNotificationTemplates) {
    foreach ($eventNotificationTemplates as $eventNotificationTemplate) {
        /* @var $eventNotificationTemplate EmailNotificationTemplate */
        $lastId = $eventNotificationTemplate->getId();
        $categoryId = new kEvalStringField();
        $categoryId->setCode('$scope->getEvent()->getObject()->getCategoryId()');
        $categoryUserFilter = new categoryKuserFilter();
        if ($eventNotificationTemplate->getSystemName() == 'Entry_Was_Added_To_Channel') {
            $categoryUserFilter->set('_matchor_permission_names', 'CATEGORY_SUBSCRIBE');
        } else {
            $categoryUserFilter->set('_matchor_permission_names', 'CATEGORY_MODERATE');
        }
        $bcc = new kEmailNotificationCategoryRecipientProvider();
        $bcc->setCategoryId($categoryId);
        $bcc->setCategoryUserFilter($categoryUserFilter);
        $eventNotificationTemplate->setBcc($bcc);
        $eventNotificationTemplate->setTo(null);
        $eventNotificationTemplate->save();
        $count++;
    }
    $criteria->add(EventNotificationTemplatePeer::ID, $lastId, Criteria::GREATER_THAN);
    $eventNotificationTemplates = EventNotificationTemplatePeer::doSelect($criteria);
}
KalturaLog::log('Done: updated ' . $count . ' templates');
 /**
  * Retrieve event notification templates according to systemName
  * @param string $systemName
  * @param int $excludeId
  * @param array<int> $partnerIds
  * @param PropelPDO $con
  * @return EventNotificationTemplate
  */
 public static function retrieveBySystemName($systemName, $excludeId = null, $partnerIds = null, PropelPDO $con = null)
 {
     $criteria = new Criteria(EventNotificationTemplatePeer::DATABASE_NAME);
     $criteria->add(EventNotificationTemplatePeer::STATUS, EventNotificationTemplateStatus::ACTIVE);
     $criteria->add(EventNotificationTemplatePeer::SYSTEM_NAME, $systemName);
     if ($excludeId) {
         $criteria->add(EventNotificationTemplatePeer::ID, $excludeId, Criteria::NOT_EQUAL);
     }
     // use the partner ids list if given
     if (!$partnerIds) {
         $partnerIds = array(kCurrentContext::getCurrentPartnerId());
     }
     $criteria->add(EventNotificationTemplatePeer::PARTNER_ID, $partnerIds, Criteria::IN);
     $criteria->addDescendingOrderByColumn(EventNotificationTemplatePeer::PARTNER_ID);
     return EventNotificationTemplatePeer::doSelectOne($criteria);
 }