本文整理汇总了PHP中OMBuilder::getPeerBuilder方法的典型用法代码示例。如果您正苦于以下问题:PHP OMBuilder::getPeerBuilder方法的具体用法?PHP OMBuilder::getPeerBuilder怎么用?PHP OMBuilder::getPeerBuilder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OMBuilder
的用法示例。
在下文中一共展示了OMBuilder::getPeerBuilder方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addShiftRank
protected function addShiftRank(&$script)
{
$useScope = $this->behavior->useScope();
$peerClassname = $this->peerClassname;
$script .= "\n/**\n * Adds \$delta to all Rank values that are >= \$first and <= \$last.\n * '\$delta' can also be negative.\n *\n * @param int \$delta Value to be shifted by, can be negative\n * @param int \$first First node to be shifted\n * @param int \$last Last node to be shifted";
if ($useScope) {
$script .= "\n * @param mixed \$scope Scope to use for the shift. Scalar value (single scope) or array";
}
$script .= "\n * @param PropelPDO \$con Connection to use.\n */\npublic static function shiftRank(\$delta, \$first = null, \$last = null, " . ($useScope ? "\$scope = null, " : "") . "PropelPDO \$con = null)\n{\n if (\$con === null) {\n \$con = Propel::getConnection({$peerClassname}::DATABASE_NAME, Propel::CONNECTION_WRITE);\n }\n\n \$whereCriteria = {$this->queryClassname}::create();\n if (null !== \$first) {\n \$whereCriteria->add({$peerClassname}::RANK_COL, \$first, Criteria::GREATER_EQUAL);\n }\n if (null !== \$last) {\n \$whereCriteria->addAnd({$peerClassname}::RANK_COL, \$last, Criteria::LESS_EQUAL);\n }";
if ($useScope) {
$script .= "\n {$this->peerClassname}::sortableApplyScopeCriteria(\$whereCriteria, \$scope);";
}
$script .= "\n\n \$valuesCriteria = new Criteria({$peerClassname}::DATABASE_NAME);\n \$valuesCriteria->add({$peerClassname}::RANK_COL, array('raw' => {$peerClassname}::RANK_COL . ' + ?', 'value' => \$delta), Criteria::CUSTOM_EQUAL);\n\n {$this->builder->getPeerBuilder()->getBasePeerClassname()}::doUpdate(\$whereCriteria, \$valuesCriteria, \$con);\n {$peerClassname}::clearInstancePool();\n}\n";
}