/**
  * @param string $systemName
  * @return ResponseProfile
  */
 public static function retrieveBySystemName($systemName, $exceptId = null)
 {
     $criteria = new Criteria(ResponseProfilePeer::DATABASE_NAME);
     $criteria->add(ResponseProfilePeer::SYSTEM_NAME, $systemName);
     $criteria->add(ResponseProfilePeer::STATUS, ResponseProfileStatus::ENABLED);
     if ($exceptId) {
         $criteria->add(ResponseProfilePeer::ID, $exceptId, Criteria::NOT_EQUAL);
     }
     $criteria->addDescendingOrderByColumn(ResponseProfilePeer::PARTNER_ID);
     return ResponseProfilePeer::doSelectOne($criteria);
 }
 public function validateForUsage($sourceObject, $propertiesToSkip = array())
 {
     // Allow null in case of update
     $this->validatePropertyMinLength('systemName', 2, !is_null($sourceObject));
     //Check uniqueness of new object's system name
     $systemNameProfile = ResponseProfilePeer::retrieveBySystemName($this->systemName, $sourceObject && $sourceObject->getId() ? $sourceObject->getId() : null);
     if ($systemNameProfile) {
         throw new KalturaAPIException(KalturaErrors::RESPONSE_PROFILE_DUPLICATE_SYSTEM_NAME, $this->systemName);
     }
     $id = $this->id;
     if ($sourceObject && $sourceObject->getId()) {
         $id = $sourceObject->getId();
     }
     parent::validateForUsage($sourceObject, $propertiesToSkip);
 }
 public function validateForUsage($sourceObject, $propertiesToSkip = array())
 {
     // Allow null in case of update
     $this->validatePropertyMinLength('systemName', 2, !is_null($sourceObject));
     $id = $this->id;
     if ($sourceObject && $sourceObject->getId()) {
         $id = $sourceObject->getId();
     }
     if (trim($this->systemName) && !$this->isNull('systemName')) {
         $systemNameTemplates = ResponseProfilePeer::retrieveBySystemName($this->systemName, $id);
         if (count($systemNameTemplates)) {
             throw new KalturaAPIException(KalturaErrors::RESPONSE_PROFILE_DUPLICATE_SYSTEM_NAME, $this->systemName);
         }
     }
     parent::validateForUsage($sourceObject, $propertiesToSkip);
 }
 /**
  * List response profiles by filter and pager
  * 
  * @action list
  * @param KalturaFilterPager $filter
  * @param KalturaResponseProfileFilter $pager
  * @return KalturaResponseProfileListResponse
  */
 function listAction(KalturaResponseProfileFilter $filter = null, KalturaFilterPager $pager = null)
 {
     if (!$filter) {
         $filter = new KalturaResponseProfileFilter();
     }
     if (!$pager) {
         $pager = new KalturaFilterPager();
     }
     $responseProfileFilter = new ResponseProfileFilter();
     $filter->toObject($responseProfileFilter);
     $c = new Criteria();
     $responseProfileFilter->attachToCriteria($c);
     $totalCount = ResponseProfilePeer::doCount($c);
     $pager->attachToCriteria($c);
     $dbList = ResponseProfilePeer::doSelect($c);
     $list = KalturaResponseProfileArray::fromDbArray($dbList, $this->getResponseProfile());
     $response = new KalturaResponseProfileListResponse();
     $response->objects = $list;
     $response->totalCount = $totalCount;
     return $response;
 }
 /**
  * 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(ResponseProfilePeer::DATABASE_NAME);
         $criteria->add(ResponseProfilePeer::ID, $pks, Criteria::IN);
         $objs = ResponseProfilePeer::doSelect($criteria, $con);
     }
     return $objs;
 }
 public function getFieldNameFromPeer($field_name)
 {
     $res = ResponseProfilePeer::translateFieldName($field_name, $this->field_name_translation_type, BasePeer::TYPE_COLNAME);
     return $res;
 }
 /**
  * @return KalturaDetachedResponseProfile
  */
 public function getResponseProfile($paramName = 'responseProfile')
 {
     if (!isset($this->paramsGrouped[$paramName])) {
         return null;
     }
     $partnerId = kCurrentContext::getCurrentPartnerId();
     myPartnerUtils::addPartnerToCriteria('ResponseProfile', $partnerId, true, "{$partnerId},0");
     $responseProfile = null;
     if (isset($this->paramsGrouped[$paramName]['id'])) {
         $responseProfile = ResponseProfilePeer::retrieveByPK($this->paramsGrouped[$paramName]['id']);
     }
     if (isset($this->paramsGrouped[$paramName]['systemName'])) {
         $responseProfile = ResponseProfilePeer::retrieveBySystemName($this->paramsGrouped[$paramName]['systemName']);
     }
     if ($responseProfile) {
         return new KalturaResponseProfile($responseProfile);
     }
     $typeReflector = KalturaTypeReflectorCacher::get('KalturaDetachedResponseProfile');
     return $this->buildObject($typeReflector, $this->paramsGrouped[$paramName], $paramName);
 }
 /**
  * @return KalturaDetachedResponseProfile
  */
 public function getResponseProfile($paramName = 'responseProfile')
 {
     if (!isset($this->paramsGrouped[$paramName])) {
         return null;
     }
     $responseProfile = null;
     if (isset($this->paramsGrouped[$paramName]['id'])) {
         $responseProfile = ResponseProfilePeer::retrieveByPK($this->paramsGrouped[$paramName]['id']);
     }
     if (isset($this->paramsGrouped[$paramName]['systemName'])) {
         $responseProfile = ResponseProfilePeer::retrieveBySystemName($this->paramsGrouped[$paramName]['systemName']);
     }
     if ($responseProfile) {
         return new KalturaResponseProfile($responseProfile);
     }
     $typeReflector = KalturaTypeReflectorCacher::get('KalturaDetachedResponseProfile');
     return $this->buildObject($typeReflector, $this->paramsGrouped[$paramName], $paramName);
 }
 /**
  * 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(ResponseProfilePeer::DATABASE_NAME);
     $criteria->add(ResponseProfilePeer::ID, $this->id);
     if ($this->alreadyInSave) {
         if ($this->isColumnModified(ResponseProfilePeer::CUSTOM_DATA)) {
             if (!is_null($this->custom_data_md5)) {
                 $criteria->add(ResponseProfilePeer::CUSTOM_DATA, "MD5(cast(" . ResponseProfilePeer::CUSTOM_DATA . " as char character set latin1)) = '{$this->custom_data_md5}'", Criteria::CUSTOM);
             } else {
                 $criteria->add(ResponseProfilePeer::CUSTOM_DATA, NULL, Criteria::ISNULL);
             }
         }
         if (count($this->modifiedColumns) == 2 && $this->isColumnModified(ResponseProfilePeer::UPDATED_AT)) {
             $theModifiedColumn = null;
             foreach ($this->modifiedColumns as $modifiedColumn) {
                 if ($modifiedColumn != ResponseProfilePeer::UPDATED_AT) {
                     $theModifiedColumn = $modifiedColumn;
                 }
             }
             $atomicColumns = ResponseProfilePeer::getAtomicColumns();
             if (in_array($theModifiedColumn, $atomicColumns)) {
                 $criteria->add($theModifiedColumn, $this->getByName($theModifiedColumn, BasePeer::TYPE_COLNAME), Criteria::NOT_EQUAL);
             }
         }
     }
     return $criteria;
 }
 /**
  * Clone an existing response profile
  * 
  * @action clone
  * @param int $id
  * @param KalturaResponseProfile $profile
  * @throws KalturaErrors::RESPONSE_PROFILE_ID_NOT_FOUND
  * @throws KalturaErrors::RESPONSE_PROFILE_DUPLICATE_SYSTEM_NAME
  * @return KalturaResponseProfile
  */
 function cloneAction($id, KalturaResponseProfile $profile)
 {
     $origResponseProfileDbObject = ResponseProfilePeer::retrieveByPK($id);
     if (!$origResponseProfileDbObject) {
         throw new KalturaAPIException(KalturaErrors::RESPONSE_PROFILE_ID_NOT_FOUND, $id);
     }
     $newResponseProfileDbObject = $origResponseProfileDbObject->copy();
     if ($profile) {
         $newResponseProfileDbObject = $profile->toInsertableObject($newResponseProfileDbObject);
     }
     $newResponseProfileDbObject->save();
     $newResponseProfile = new KalturaResponseProfile();
     $newResponseProfile->fromObject($newResponseProfileDbObject, $this->getResponseProfile());
     return $newResponseProfile;
 }