public function getFieldNameFromPeer($field_name)
 {
     if ($field_name == 'partner_description') {
         return CaptionAssetItemPeer::PARTNER_DESCRIPTION;
     }
     if ($field_name == 'language') {
         return CaptionAssetItemPeer::LANGUAGE;
     }
     if ($field_name == 'label') {
         return CaptionAssetItemPeer::LABEL;
     }
     if ($field_name == 'status') {
         return CaptionAssetItemPeer::STATUS;
     }
     if ($field_name == 'size') {
         return CaptionAssetItemPeer::SIZE;
     }
     if ($field_name == 'updated_at') {
         return CaptionAssetItemPeer::UPDATED_AT;
     }
     if ($field_name == 'format') {
         return CaptionAssetItemPeer::FORMAT;
     }
     return CaptionAssetItemPeer::translateFieldName($field_name, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_COLNAME);
 }
 public function objectDeleted(BaseObject $object, BatchJob $raisedJob = null)
 {
     /* @var $object CaptionAsset */
     // delete them one by one to raise the erased event
     $captionAssetItems = CaptionAssetItemPeer::retrieveByAssetId($object->getId());
     foreach ($captionAssetItems as $captionAssetItem) {
         /* @var $captionAssetItem CaptionAssetItem */
         $captionAssetItem->delete();
     }
     // updates entry on order to trigger reindexing
     $entry = $object->getentry();
     $entry->setUpdatedAt(time());
     $entry->save();
 }
 public static function doCountOnPeer(Criteria $c)
 {
     return CaptionAssetItemPeer::doCount($c);
 }
 protected function doCountOnPeer(Criteria $c)
 {
     return CaptionAssetItemPeer::doCount($c);
 }
 /**
  * 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(CaptionAssetItemPeer::DATABASE_NAME);
         $criteria->add(CaptionAssetItemPeer::ID, $pks, Criteria::IN);
         $objs = CaptionAssetItemPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
 /**
  * Search caption asset items by filter, pager and free text
  * 
  * @action search
  * @param KalturaBaseEntryFilter $entryFilter
  * @param KalturaCaptionAssetItemFilter $captionAssetItemFilter
  * @param KalturaFilterPager $captionAssetItemPager
  * @return KalturaCaptionAssetItemListResponse
  */
 function searchAction(KalturaBaseEntryFilter $entryFilter = null, KalturaCaptionAssetItemFilter $captionAssetItemFilter = null, KalturaFilterPager $captionAssetItemPager = null)
 {
     if (!$captionAssetItemPager) {
         $captionAssetItemPager = new KalturaFilterPager();
     }
     if (!$captionAssetItemFilter) {
         $captionAssetItemFilter = new KalturaCaptionAssetItemFilter();
     }
     $captionAssetItemCoreFilter = new CaptionAssetItemFilter();
     $captionAssetItemFilter->toObject($captionAssetItemCoreFilter);
     if ($entryFilter) {
         $entryCoreFilter = new entryFilter();
         $entryFilter->toObject($entryCoreFilter);
         $this->addEntryAdvancedSearchFilter($captionAssetItemFilter, $entryCoreFilter);
         $entryCriteria = KalturaCriteria::create(entryPeer::OM_CLASS);
         $entryCoreFilter->attachToCriteria($entryCriteria);
         $entryCriteria->applyFilters();
         $entryIds = $entryCriteria->getFetchedIds();
         if (!$entryIds || !count($entryIds)) {
             $entryIds = array('NOT_EXIST');
         }
         $captionAssetItemCoreFilter->setEntryIdIn($entryIds);
     }
     $captionAssetItemCriteria = KalturaCriteria::create(CaptionAssetItemPeer::OM_CLASS);
     $captionAssetItemCoreFilter->attachToCriteria($captionAssetItemCriteria);
     $captionAssetItemPager->attachToCriteria($captionAssetItemCriteria);
     $dbList = CaptionAssetItemPeer::doSelect($captionAssetItemCriteria);
     $list = KalturaCaptionAssetItemArray::fromDbArray($dbList);
     $response = new KalturaCaptionAssetItemListResponse();
     $response->objects = $list;
     $response->totalCount = $captionAssetItemCriteria->getRecordsCount();
     return $response;
 }
 /**
  * Search caption asset items by filter, pager and free text
  *
  * @action search
  * @param KalturaBaseEntryFilter $entryFilter
  * @param KalturaCaptionAssetItemFilter $captionAssetItemFilter
  * @param KalturaFilterPager $captionAssetItemPager
  * @return KalturaCaptionAssetItemListResponse
  */
 function searchAction(KalturaBaseEntryFilter $entryFilter = null, KalturaCaptionAssetItemFilter $captionAssetItemFilter = null, KalturaFilterPager $captionAssetItemPager = null)
 {
     if (!$captionAssetItemPager) {
         $captionAssetItemPager = new KalturaFilterPager();
     }
     if (!$captionAssetItemFilter) {
         $captionAssetItemFilter = new KalturaCaptionAssetItemFilter();
     }
     $captionAssetItemFilter->validatePropertyNotNull(array("contentLike", "contentMultiLikeOr", "contentMultiLikeAnd"));
     $captionAssetItemCoreFilter = new CaptionAssetItemFilter();
     $captionAssetItemFilter->toObject($captionAssetItemCoreFilter);
     if ($entryFilter || kEntitlementUtils::getEntitlementEnforcement()) {
         $entryCoreFilter = new entryFilter();
         if ($entryFilter) {
             $entryFilter->toObject($entryCoreFilter);
         }
         $entryCoreFilter->setPartnerSearchScope($this->getPartnerId());
         $this->addEntryAdvancedSearchFilter($captionAssetItemFilter, $entryCoreFilter);
         $entryCriteria = KalturaCriteria::create(entryPeer::OM_CLASS);
         $entryCoreFilter->attachToCriteria($entryCriteria);
         $entryCriteria->applyFilters();
         $entryIds = $entryCriteria->getFetchedIds();
         if (!$entryIds || !count($entryIds)) {
             $entryIds = array('NOT_EXIST');
         }
         $captionAssetItemCoreFilter->setEntryIdIn($entryIds);
     }
     $captionAssetItemCriteria = KalturaCriteria::create(CaptionAssetItemPeer::OM_CLASS);
     $captionAssetItemCoreFilter->attachToCriteria($captionAssetItemCriteria);
     $captionAssetItemPager->attachToCriteria($captionAssetItemCriteria);
     $dbList = CaptionAssetItemPeer::doSelect($captionAssetItemCriteria);
     $list = KalturaCaptionAssetItemArray::fromDbArray($dbList, $this->getResponseProfile());
     $response = new KalturaCaptionAssetItemListResponse();
     $response->objects = $list;
     $response->totalCount = $captionAssetItemCriteria->getRecordsCount();
     return $response;
 }
 public static function retrieveByAssetId($assetId, PropelPDO $con = null)
 {
     $criteria = new Criteria();
     $criteria->add(CaptionAssetItemPeer::CAPTION_ASSET_ID, $assetId);
     return CaptionAssetItemPeer::doSelect($criteria, $con);
 }
    $c->add(CaptionAssetItemPeer::PARTNER_ID, $argv[2], Criteria::EQUAL);
}
if ($argc > 3 && is_numeric($argv[3])) {
    $c->add(CaptionAssetItemPeer::ID, $argv[3], Criteria::GREATER_EQUAL);
}
if ($argc > 4) {
    CaptionAssetItemPeer::setUseCriteriaFilter((bool) $argv[4]);
}
$c->addAscendingOrderByColumn(CaptionAssetItemPeer::CREATED_AT);
$c->addAscendingOrderByColumn(CaptionAssetItemPeer::ID);
$c->setLimit(10000);
$con = myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL2);
//$sphinxCon = DbManager::getSphinxConnection();
$captions = CaptionAssetItemPeer::doSelect($c, $con);
$sphinx = new kSphinxSearchManager();
while (count($captions)) {
    foreach ($captions as $caption) {
        KalturaLog::log('caption_asset_id ' . $caption->getId() . ' int id[' . $caption->getIntId() . '] crc id[' . $sphinx->getSphinxId($caption) . '] last updated at [' . $caption->getUpdatedAt(null) . ']');
        try {
            $ret = $sphinx->saveToSphinx($caption, true);
        } catch (Exception $e) {
            KalturaLog::err($e->getMessage());
            exit - 1;
        }
    }
    $c->setOffset($c->getOffset() + count($captions));
    kMemoryManager::clearMemory();
    $captions = CaptionAssetItemPeer::doSelect($c, $con);
}
KalturaLog::log('Done. Cureent time: ' . time());
exit(0);
 /**
  * Populates the object using an array.
  *
  * This is particularly useful when populating an object from one of the
  * request arrays (e.g. $_POST).  This method goes through the column
  * names, checking to see whether a matching key exists in populated
  * array. If so the setByName() method is called for that column.
  *
  * You can specify the key type of the array by additionally passing one
  * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  * The default key type is the column's phpname (e.g. 'AuthorId')
  *
  * @param      array  $arr     An array to populate the object from.
  * @param      string $keyType The type of keys the array uses.
  * @return     void
  */
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = CaptionAssetItemPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setCreatedAt($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setPartnerId($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setEntryId($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setCaptionAssetId($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setContent($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setStartTime($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setEndTime($arr[$keys[7]]);
     }
 }