本文整理汇总了PHP中assetPeer::doSelectStmt方法的典型用法代码示例。如果您正苦于以下问题:PHP assetPeer::doSelectStmt方法的具体用法?PHP assetPeer::doSelectStmt怎么用?PHP assetPeer::doSelectStmt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类assetPeer
的用法示例。
在下文中一共展示了assetPeer::doSelectStmt方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reload
/**
* 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(assetPeer::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.
assetPeer::setUseCriteriaFilter(false);
$stmt = assetPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
assetPeer::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?
$this->aentry = null;
$this->aassetParams = null;
$this->collmediaInfos = null;
$this->lastmediaInfoCriteria = null;
$this->collassetParamsOutputs = null;
$this->lastassetParamsOutputCriteria = null;
}
// if (deep)
}
示例2: doSelectJoinAll
/**
* Selects a collection of asset objects pre-filled with all related objects.
*
* @param Criteria $criteria
* @param PropelPDO $con
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
* @return array Array of asset objects.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
$criteria = clone $criteria;
// Set the correct dbName if it has not been overridden
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(self::DATABASE_NAME);
}
assetPeer::addSelectColumns($criteria);
$startcol2 = assetPeer::NUM_COLUMNS - assetPeer::NUM_LAZY_LOAD_COLUMNS;
entryPeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + (entryPeer::NUM_COLUMNS - entryPeer::NUM_LAZY_LOAD_COLUMNS);
assetParamsPeer::addSelectColumns($criteria);
$startcol4 = $startcol3 + (assetParamsPeer::NUM_COLUMNS - assetParamsPeer::NUM_LAZY_LOAD_COLUMNS);
$criteria->addJoin(assetPeer::ENTRY_ID, entryPeer::ID, $join_behavior);
$criteria->addJoin(assetPeer::FLAVOR_PARAMS_ID, assetParamsPeer::ID, $join_behavior);
$stmt = assetPeer::doSelectStmt($criteria, $con);
$results = array();
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key1 = assetPeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj1 = assetPeer::getInstanceFromPool($key1))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://propel.phpdb.org/trac/ticket/509
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$omClass = assetPeer::getOMClass($row, 0);
$cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
$obj1 = new $cls();
$obj1->hydrate($row);
assetPeer::addInstanceToPool($obj1, $key1);
}
// if obj1 already loaded
// Add objects for joined entry rows
$key2 = entryPeer::getPrimaryKeyHashFromRow($row, $startcol2);
if ($key2 !== null) {
$obj2 = entryPeer::getInstanceFromPool($key2);
if (!$obj2) {
$omClass = entryPeer::getOMClass($row, $startcol2);
$cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
$obj2 = new $cls();
$obj2->hydrate($row, $startcol2);
entryPeer::addInstanceToPool($obj2, $key2);
}
// if obj2 loaded
// Add the $obj1 (asset) to the collection in $obj2 (entry)
$obj2->addasset($obj1);
}
// if joined row not null
// Add objects for joined assetParams rows
$key3 = assetParamsPeer::getPrimaryKeyHashFromRow($row, $startcol3);
if ($key3 !== null) {
$obj3 = assetParamsPeer::getInstanceFromPool($key3);
if (!$obj3) {
$omClass = assetParamsPeer::getOMClass($row, $startcol3);
$cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
$obj3 = new $cls();
$obj3->hydrate($row, $startcol3);
assetParamsPeer::addInstanceToPool($obj3, $key3);
}
// if obj3 loaded
// Add the $obj1 (asset) to the collection in $obj3 (assetParams)
$obj3->addasset($obj1);
}
// if joined row not null
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
示例3: doSelectStmt
public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
{
self::getInstance();
return parent::doSelectStmt($criteria, $con);
}
示例4: deleteErrorAssets
protected static function deleteErrorAssets()
{
$criteria = new Criteria();
$criteria->add(assetPeer::STATUS, array(asset::ASSET_STATUS_READY, asset::ASSET_STATUS_DELETED), Criteria::NOT_IN);
$criteria->add(assetPeer::UPDATED_AT, self::$errObjectsUpdatedAt, Criteria::LESS_THAN);
$criteria->addSelectColumn('UNIX_TIMESTAMP(MIN(' . assetPeer::UPDATED_AT . '))');
$stmt = assetPeer::doSelectStmt($criteria);
$mins = $stmt->fetchAll(PDO::FETCH_COLUMN);
if (!count($mins)) {
return;
}
$errObjectsUpdatedAtStart = reset($mins);
if (is_null($errObjectsUpdatedAtStart)) {
return;
}
$errObjectsUpdatedAtEnd = min(self::$errObjectsUpdatedAt, $errObjectsUpdatedAtStart + 60 * 60 * 24 * 30);
// month
$criteria = new Criteria();
$criteria->add(assetPeer::STATUS, array(asset::ASSET_STATUS_READY, asset::ASSET_STATUS_DELETED), Criteria::NOT_IN);
$criteria->add(assetPeer::UPDATED_AT, $errObjectsUpdatedAtStart, Criteria::LESS_THAN);
$criteria->addAnd(entryPeer::UPDATED_AT, $errObjectsUpdatedAtEnd, Criteria::LESS_THAN);
$criteria->addDescendingOrderByColumn(assetPeer::SIZE);
$criteria->setLimit(self::$queryLimit);
$assets = assetPeer::doSelect($criteria);
foreach ($assets as $asset) {
/* @var $asset asset */
KalturaLog::info("Deleting asset [" . $asset->getId() . "]");
$asset->setStatus(asset::ASSET_STATUS_DELETED);
try {
$asset->save();
} catch (Exception $e) {
KalturaLog::err($e);
}
}
self::incrementSummary('asset', count($assets));
kMemoryManager::clearMemory();
}
示例5: getReadyIdsByParamsIds
/**
* @param string $entryId
* @param array $paramsIds
* @param $con
*
* @return array
*/
public static function getReadyIdsByParamsIds($entryId, array $paramsIds, $con = null)
{
$criteria = new Criteria();
$criteria->addSelectColumn(assetPeer::ID);
$criteria->add(assetPeer::ENTRY_ID, $entryId);
$criteria->add(assetPeer::STATUS, asset::FLAVOR_ASSET_STATUS_READY);
$criteria->add(assetPeer::FLAVOR_PARAMS_ID, $paramsIds, Criteria::IN);
$stmt = assetPeer::doSelectStmt($criteria, $con);
return $stmt->fetchAll(PDO::FETCH_COLUMN);
}
示例6: foreach
$entryCriteria->clearSelectColumns();
$entryCriteria->addSelectColumn(entryPeer::ID);
$con = myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL2);
$rs = entryPeer::doSelectStmt($entryCriteria, $con);
$entries = $rs->fetchAll(PDO::FETCH_COLUMN);
$saved = 0;
foreach ($entries as $entryId) {
entryPeer::clearInstancePool();
assetPeer::clearInstancePool();
mediaInfoPeer::clearInstancePool();
$flavorAssetCriteria = new Criteria();
$flavorAssetCriteria->add(assetPeer::STATUS, flavorAsset::FLAVOR_ASSET_STATUS_READY);
$flavorAssetCriteria->clearSelectColumns();
$flavorAssetCriteria->addSelectColumn(assetPeer::ID);
$flavorAssetCriteria->add(assetPeer::ENTRY_ID, $entryId);
$rs = assetPeer::doSelectStmt($flavorAssetCriteria, $con);
$flavorAssets = $rs->fetchAll(PDO::FETCH_COLUMN);
if (!count($flavorAssets)) {
continue;
}
$criteria = new Criteria();
$criteria->add(mediaInfoPeer::FLAVOR_ASSET_ID, $flavorAssets, Criteria::IN);
$criteria->addDescendingOrderByColumn(mediaInfoPeer::ID);
$mediaInfos = mediaInfoPeer::doSelect($criteria, $con);
if (!count($mediaInfos)) {
continue;
}
$entry = entryPeer::retrieveByPK($entryId, $con);
if (!$entry) {
continue;
}