本文整理匯總了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;
}