本文整理汇总了PHP中OMBuilder::getStubObjectBuilder方法的典型用法代码示例。如果您正苦于以下问题:PHP OMBuilder::getStubObjectBuilder方法的具体用法?PHP OMBuilder::getStubObjectBuilder怎么用?PHP OMBuilder::getStubObjectBuilder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OMBuilder
的用法示例。
在下文中一共展示了OMBuilder::getStubObjectBuilder方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addFindOne
/**
* @param string $script
*/
protected function addFindOne(&$script)
{
$className = $this->builder->getStubObjectBuilder()->getClassname();
$peerClassName = $this->builder->getStubPeerBuilder()->getClassname();
$script .= "\n/**\n * Issue a SELECT ... LIMIT 1 query based on the current ModelCriteria\n * and format the result with the current formatter\n * By default, returns a model object\n *\n * @param PropelPDO \$con an optional connection object\n *\n * @return mixed|{$className} the result, formatted by the current formatter\n */\npublic function findOne(\$con = null)\n{\n if (\$this->isCacheEnable() && \$cache = {$peerClassName}::cacheFetch(\$this->getCacheKey())) {\n if (\$cache instanceof {$className}) {\n return \$cache;\n }\n }\n\n if (\$con === null) {\n \$con = Propel::getConnection(\$this->getDbName(), Propel::CONNECTION_READ);\n }\n \$this->basePreSelect(\$con);\n \$criteria = \$this->isKeepQuery() ? clone \$this : \$this;\n \$criteria->limit(1);\n \$stmt = \$criteria->doSelect(\$con);\n\n \$data = \$criteria->getFormatter()->init(\$criteria)->formatOne(\$stmt);\n\n if (\$this->isCacheEnable()) {\n {$peerClassName}::cacheStore(\$this->getCacheKey(), \$data, \$this->getLifeTime());\n }\n\n return \$data;\n}\n ";
}
开发者ID:stevleibelt,项目名称:PropelDataCacheBehavior,代码行数:9,代码来源:DataCacheBehaviorQueryBuilderModifier.php