本文整理汇总了PHP中assetParamsPeer::getCriteriaFilter方法的典型用法代码示例。如果您正苦于以下问题:PHP assetParamsPeer::getCriteriaFilter方法的具体用法?PHP assetParamsPeer::getCriteriaFilter怎么用?PHP assetParamsPeer::getCriteriaFilter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类assetParamsPeer
的用法示例。
在下文中一共展示了assetParamsPeer::getCriteriaFilter方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFlavorParamsFromFileFormat
/**
* return the flavor params the best fits the fileFormat for a given partner_id
*
* @param int $partnerId
* @param string $fileFormat
* @return FlavorParams
*/
public static function getFlavorParamsFromFileFormat($partnerId, $fileFormat, $ignoreSourceTag = true)
{
$defaultCriteria = assetParamsPeer::getCriteriaFilter()->getFilter();
$defaultCriteria->remove(assetParamsPeer::PARTNER_ID);
// assetParamsPeer::allowAccessToPartner0AndPartnerX($partnerId); // the flavor params can be from partner 0 too
$c = new Criteria();
$c->addAnd(assetParamsPeer::PARTNER_ID, array($partnerId, 0), Criteria::IN);
// $c->add ( assetParamsPeer::FORMAT , $fileFormat );
$possible_flavor_params = assetParamsPeer::doSelect($c);
myPartnerUtils::resetPartnerFilter('assetParams');
$best_fp = null;
foreach ($possible_flavor_params as $fp) {
if ($fileFormat != $fp->getFormat()) {
continue;
}
if ($ignoreSourceTag && $fp->hasTag(flavorParams::TAG_SOURCE)) {
continue;
}
if (!$best_fp) {
$best_fp = $fp;
}
if ($fp->getPartnerId() != $partnerId) {
continue;
}
// same format for the partner
$best_fp = $fp;
break;
}
// if not fount any - choose the first flavor params from the list
if (!$best_fp) {
$best_fp = $possible_flavor_params[0];
}
return $best_fp;
}
示例2: attachCriteriaFilter
/**
* the filterCriteria will filter out all the doSelect methods - ONLY if the filter is turned on.
* IMPORTANT - the filter is turend on by default and when switched off - should be turned on again manually .
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
*/
protected static function attachCriteriaFilter(Criteria $criteria)
{
assetParamsPeer::getCriteriaFilter()->applyFilter($criteria);
}
示例3: filterSelectResults
public static function filterSelectResults(&$selectResults, Criteria $criteria)
{
$criteria_filter = assetParamsPeer::getCriteriaFilter();
if (!$criteria_filter->isEnabled() || !self::$filterPartner) {
return;
}
$selectResults = array_filter($selectResults, array('assetParamsPeer', 'filterSelectResultsCallback'));
}
示例4: populateObjects
/**
* Overrides parent populateObjects method
* Force partner required permissions
*
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function populateObjects(PDOStatement $stmt)
{
$criteria_filter = assetParamsPeer::getCriteriaFilter();
$results = array();
// populate the object(s)
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key = assetParamsPeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj = assetParamsPeer::getInstanceFromPool($key))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://propel.phpdb.org/trac/ticket/509
// $obj->hydrate($row, 0, true); // rehydrate
$results[] = $obj;
} else {
// class must be set each time from the record row
$cls = assetParamsPeer::getOMClass($row, 0);
$cls = substr('.' . $cls, strrpos('.' . $cls, '.') + 1);
$obj = new $cls();
$obj->hydrate($row);
if ($criteria_filter->isEnabled() && self::$filterPartner) {
$requiredPermissions = $obj->getRequiredPermissions();
if ($requiredPermissions && count($requiredPermissions)) {
foreach ($requiredPermissions as $requiredPermission) {
if (!PermissionPeer::isValidForPartner($requiredPermission, self::$filterPartner)) {
self::excludeId($obj->getId());
$obj = null;
}
}
}
}
if ($obj) {
$results[] = $obj;
assetParamsPeer::addInstanceToPool($obj, $key);
}
}
// if key exists
}
$stmt->closeCursor();
return $results;
}