本文整理汇总了PHP中Record::buildSql方法的典型用法代码示例。如果您正苦于以下问题:PHP Record::buildSql方法的具体用法?PHP Record::buildSql怎么用?PHP Record::buildSql使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Record
的用法示例。
在下文中一共展示了Record::buildSql方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: findByNameAndPageId
public static function findByNameAndPageId($name, $id, $class = __CLASS__)
{
$params['where'] = sprintf("name='%s' AND page_id=%d", $name, $id);
$sql = Record::buildSql($params, $class);
return self::connection()->query($sql, PDO::FETCH_CLASS, $class)->fetch();
}
示例2: find
public static function find($params = null, $class = __CLASS__)
{
$retval = array();
$sql = Record::buildSql($params, $class);
foreach (self::connection()->query($sql, PDO::FETCH_CLASS, $class) as $object) {
$retval[] = $object;
}
return $retval;
}
示例3: findBySlugAndParentId
public static function findBySlugAndParentId($slug, $parent_id = 0, $class = __CLASS__)
{
/* TODO: Behaviour pagehack seems kludgish. */
$parent = Page::findById($parent_id);
if ($parent && $parent->behaviorId()) {
$class = Behavior::loadPageHack($parent->behaviorId());
}
$params['where'] = sprintf("slug=%s AND parent_id=%d", self::connection()->quote($slug), $parent_id);
$sql = Record::buildSql($params, $class);
// print_r(self::connection()->query($sql, PDO::FETCH_CLASS, $class)->fetch());
return self::connection()->query($sql, PDO::FETCH_CLASS, $class)->fetch();
}