/**
  * @param int $entryId
  */
 protected function entryDeleted($entryId)
 {
     $c = new Criteria();
     $c->add(CuePointPeer::ENTRY_ID, $entryId);
     CuePointPeer::setUseCriteriaFilter(false);
     $cuePoints = CuePointPeer::doSelect($c);
     $update = new Criteria();
     $update->add(CuePointPeer::STATUS, CuePointStatus::DELETED);
     $con = Propel::getConnection(myDbHelper::DB_HELPER_CONN_MASTER);
     BasePeer::doUpdate($c, $update, $con);
     foreach ($cuePoints as $cuePoint) {
         kEventsManager::raiseEvent(new kObjectDeletedEvent($cuePoint));
     }
 }
예제 #2
0
 protected function deleteCuePoints(Criteria $c)
 {
     CuePointPeer::setUseCriteriaFilter(false);
     $cuePoints = CuePointPeer::doSelect($c);
     $update = new Criteria();
     $update->add(CuePointPeer::STATUS, CuePointStatus::DELETED);
     $con = Propel::getConnection(myDbHelper::DB_HELPER_CONN_MASTER);
     BasePeer::doUpdate($c, $update, $con);
     CuePointPeer::setUseCriteriaFilter(true);
     foreach ($cuePoints as $cuePoint) {
         $cuePoint->setStatus(CuePointStatus::DELETED);
         $cuePoint->indexToSearchIndex();
         kEventsManager::raiseEvent(new kObjectDeletedEvent($cuePoint));
     }
 }
예제 #3
0
 /**
  * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
  *
  * This will only work if the object has been saved and has a valid primary key set.
  *
  * @param      boolean $deep (optional) Whether to also de-associated any related objects.
  * @param      PropelPDO $con (optional) The PropelPDO connection to use.
  * @return     void
  * @throws     PropelException - if this object is deleted, unsaved or doesn't have pk match in db
  */
 public function reload($deep = false, PropelPDO $con = null)
 {
     if ($this->isDeleted()) {
         throw new PropelException("Cannot reload a deleted object.");
     }
     if ($this->isNew()) {
         throw new PropelException("Cannot reload an unsaved object.");
     }
     if ($con === null) {
         $con = Propel::getConnection(CuePointPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     // We don't need to alter the object instance pool; we're just modifying this instance
     // already in the pool.
     CuePointPeer::setUseCriteriaFilter(false);
     $stmt = CuePointPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
     CuePointPeer::setUseCriteriaFilter(true);
     $row = $stmt->fetch(PDO::FETCH_NUM);
     $stmt->closeCursor();
     if (!$row) {
         throw new PropelException('Cannot find matching row in the database to reload object values.');
     }
     $this->hydrate($row, 0, true);
     // rehydrate
     if ($deep) {
         // also de-associate any related objects?
     }
     // if (deep)
 }
예제 #4
0
 public static function getCuePointSearchData(entry $entry)
 {
     $indexOnEntryTypes = self::getIndexOnEntryTypes();
     if (!count($indexOnEntryTypes)) {
         return;
     }
     $dataByType = array();
     CuePointPeer::setUseCriteriaFilter(false);
     $cuePointObjects = CuePointPeer::retrieveByEntryId($entry->getId(), $indexOnEntryTypes);
     CuePointPeer::setUseCriteriaFilter(true);
     foreach ($cuePointObjects as $cuePoint) {
         /* @var $cuePoint CuePoint */
         $contributedData = $cuePoint->contributeData();
         if (!$contributedData) {
             continue;
         }
         $cuePointType = $cuePoint->getType();
         if (!isset($dataByType[$cuePointType])) {
             $dataByType[$cuePointType] = array();
         }
         $contributedData = self::buildDataToIndexOnEntry($contributedData, $cuePointType, $cuePoint->getPartnerId(), $cuePoint->getId(), $cuePoint->getSubType());
         $dataByType[$cuePointType][] = $contributedData;
     }
     $data = array();
     foreach ($dataByType as $type => $typeData) {
         $data = array_merge($data, $typeData);
     }
     $dataField = CuePointPlugin::getSearchFieldName(CuePointPlugin::SEARCH_FIELD_DATA);
     $searchValues = array($dataField => CuePointPlugin::PLUGIN_NAME . "_" . $entry->getPartnerId() . ' ' . implode(' ', $data) . ' ' . CuePointPlugin::SEARCH_TEXT_SUFFIX);
     return $searchValues;
 }
예제 #5
0
<?php

chdir(dirname(__FILE__));
require_once __DIR__ . '/../../bootstrap.php';
$c = new Criteria();
if ($argc > 1 && is_numeric($argv[1])) {
    $c->add(CuePointPeer::UPDATED_AT, $argv[1], Criteria::GREATER_EQUAL);
}
if ($argc > 2 && is_numeric($argv[2])) {
    $c->add(CuePointPeer::PARTNER_ID, $argv[2], Criteria::EQUAL);
}
if ($argc > 3 && is_numeric($argv[3])) {
    $c->add(CuePointPeer::ID, $argv[3], Criteria::GREATER_EQUAL);
}
if ($argc > 4) {
    CuePointPeer::setUseCriteriaFilter((bool) $argv[4]);
}
$c->addAscendingOrderByColumn(CuePointPeer::UPDATED_AT);
$c->addAscendingOrderByColumn(CuePointPeer::ID);
$c->setLimit(10000);
$con = myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL2);
//$sphinxCon = DbManager::getSphinxConnection();
$entries = CuePointPeer::doSelect($c, $con);
$sphinx = new kSphinxSearchManager();
while (count($entries)) {
    foreach ($entries as $entry) {
        /* @var $entry CuePoint */
        KalturaLog::log('cue point id ' . $entry->getId() . ' updated at ' . $entry->getUpdatedAt(null));
        try {
            $ret = $sphinx->saveToSphinx($entry, true);
        } catch (Exception $e) {