本文整理汇总了PHP中DAL::query方法的典型用法代码示例。如果您正苦于以下问题:PHP DAL::query方法的具体用法?PHP DAL::query怎么用?PHP DAL::query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DAL
的用法示例。
在下文中一共展示了DAL::query方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _baseQuery
/**
*
* @return DalQuery
*/
private function _baseQuery()
{
$q = DAL::query()->select('_tree.*')->from($this->getTableName(false) . ' _tree');
//\hat\dbg::alert($q->getRootAlias(), true);
return $q;
}
示例2: _extract_nestedset_vars
private function _extract_nestedset_vars($destination = null, $for_move = true)
{
$behavior_name = 'nestedset';
$lft_key = $this->getFieldName($behavior_name, 'lft');
$rgt_key = $this->getFieldName($behavior_name, 'rgt');
$level_key = $this->getFieldName($behavior_name, 'level');
$root_id_key = $this->getFieldName($behavior_name, 'root_id');
// \hat\dbg::alert($this->_for_save);
$delta = 2;
// for insert
if ($this->_table->get('idExists')) {
$id = $this->_table->get('id');
}
if ($this->_table->isInTree()) {
if ($this->_table->get($root_id_key . 'Exists')) {
$root_id = $this->_table->get($root_id_key);
} else {
throw new \Exception("Missing node {$lft_key} column.");
return false;
}
if ($this->_table->get($lft_key . 'Exists')) {
$lft = $this->_table->get($lft_key);
} else {
throw new \Exception("Missing node {$lft_key} column.");
return false;
}
if ($this->_table->get($rgt_key . 'Exists')) {
$rgt = $this->_table->get($rgt_key);
} else {
throw new \Exception("Missing node {$rgt_key} column.");
return false;
}
if ($this->_table->get($level_key . 'Exists')) {
$level = $this->_table->get($level_key);
} else {
throw new \Exception("Missing node {$level_key} column.");
return false;
}
$delta = $rgt - $lft + 1;
}
if ($destination) {
$dest_root_id = $destination->getBehavior()->getRootId();
$dest_lft = $destination->get($lft_key);
$dest_rgt = $destination->get($rgt_key);
$dest_level = $destination->get($level_key);
}
//\hat\dbg::alert(array($dest_root_id, $root_id), true);
if ($destination && $for_move) {
if ($root_id != $dest_root_id) {
throw new \Exception("node and destination not in the same tree.");
return false;
}
$move_to_the_left = $lft > $dest_lft ? true : false;
}
$err_msg = '';
$model_name = $this->_table->getTableName(false);
$query = DAL::query();
$this->_table->setQuery($query);
$vars = \compact(array('lft_key', 'rgt_key', 'level_key', 'root_id_key', 'dest_root_id', 'dest_lft', 'dest_rgt', 'dest_level', 'id', 'root_id', 'lft', 'rgt', 'level', 'delta', 'move_to_the_left', 'model_name', 'query', 'err_msg'));
$this->_bv[$behavior_name] = $vars;
return true;
}