本文整理汇总了PHP中Doctrine_Query::getConnection方法的典型用法代码示例。如果您正苦于以下问题:PHP Doctrine_Query::getConnection方法的具体用法?PHP Doctrine_Query::getConnection怎么用?PHP Doctrine_Query::getConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine_Query
的用法示例。
在下文中一共展示了Doctrine_Query::getConnection方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* constructor
*
* @param Doctrine_Query $query
*/
public function __construct(Doctrine_Query $query, $viewName)
{
$this->name = $viewName;
$this->query = $query;
$this->query->setView($this);
$this->conn = $query->getConnection();
}
示例2: __construct
/**
* constructor
*
* @param Doctrine_Query $query
*/
public function __construct(Doctrine_Query $query, $viewName)
{
$this->_name = $viewName;
$this->_query = $query;
$this->_query->setView($this);
$this->_conn = $query->getConnection();
$this->_dql = $query->getDql();
$this->_sql = $query->getSqlQuery();
}
示例3: update
private function update($table_name, $d, $id)
{
$tid = $id;
if (!is_array($id)) {
$tid = array('id' => $id);
}
$table = Doctrine::getTable($table_name);
$dq = new Doctrine_Query();
$conn = $dq->getConnection();
return $conn->update($table, $d, $tid);
}
示例4: getSourceName
/**
* Should return the database server name or source name
*
* Ex: mysql, pgsql, array, xml
*
* @return string
*/
public function getSourceName()
{
return strtolower($this->_query->getConnection()->getDriverName());
}
示例5: modifyImpl
protected function modifyImpl(Doctrine_Query &$o)
{
if (!$this->ignoreIds) {
$table = $o->getConnection()->getTable($this->getTarget());
$keys = $table->getIdentifierColumnNames();
$o->addSelect(implode($keys));
} else {
$o->disableAutoIdentifierFields(true);
}
foreach ($this->additionalSelects as $alias => $select) {
$o->addSelect($select . (is_numeric($alias) ? "" : " AS " . $alias));
}
$db = $this->getContext()->getDatabaseManager()->getDatabase('icinga');
// check if retained state must be respected
if (method_exists($db, "useRetained")) {
/*
* the core with idomod dumps 2 different config types
* idomod.cfg:config_output_options
* 1 = original config => config_type = 0
* 2 = retained config => config_type = 1
* 3 = both, both config_types are available
*/
if ($this->retainedAlias) {
$o->andWhere($this->retainedAlias . ".config_type= ?", $db->useRetained() ? "1" : "0");
}
}
if ($this->getTarget() == "IcingaObjects") {
$o->andWhere($this->mainAlias . ".is_active = 1");
}
foreach ($this->forceGroup as $group) {
$o->addGroupBy($group);
}
parent::modifyImpl($o);
}
示例6: executeUpdateFilter
public function executeUpdateFilter(sfWebRequest $request)
{
$this->menu = $this->getMenu('index');
$this->informations = $this->getInformations();
$id = $request->getParameter('id');
$sql = <<<ENDSQL
\t\t\tSELECT domain, lists_id, ordre
\t\t\tFROM lists_filter
\t\t\tJOIN lists ON lists_filter.list_id = lists.id
\t\t\tJOIN lists_detail ON lists.id = lists_detail.lists_id
\t\t\tWHERE lists_filter.filter_id = '{$id}'
\t\t\tAND lists.origin = 'SI'
\t\t\tORDER BY ordre
ENDSQL;
$dq = new Doctrine_Query();
$conn = $dq->getConnection();
$filters_private_lists_res = $conn->fetchAll($sql);
foreach ($filters_private_lists_res as $filter) {
if ($filter['domain'] != '') {
switch ($filter['ordre']) {
case 0:
$globale_whitelist .= $filter['domain'] . "\n";
break;
case 1:
$globale_blacklist .= $filter['domain'] . "\n";
break;
case 2:
$private_whitelist .= $filter['domain'] . "\n";
break;
case 3:
$private_blacklist .= $filter['domain'] . "\n";
break;
case 4:
$other_blacklists[$filter['lists_id']] = $filter['lists_id'];
break;
}
}
}
$this->globale_whitelist = $globale_whitelist;
$this->globale_blacklist = $globale_blacklist;
$this->private_whitelist = $private_whitelist;
$this->private_blacklist = $private_blacklist;
// @TODO ////////////////////////////////////////////////////////////
$sql = <<<SQL
\t\t\tSELECT li.id, li.name, lf.ordre
\t\t\tFROM lists li
\t\t\t\tLEFT JOIN lists_filter lf ON li.id = lf.list_id
\t\t\tWHERE lf.filter_id = '{$id}'
\t\t\t\tAND li.origin != 'SI'
SQL;
$dq = new Doctrine_Query();
$conn = $dq->getConnection();
$filters_to = $conn->fetchAll($sql);
foreach ($filters_to as $filterT) {
$aaa = $filterT['id'];
$other_blacklists[$aaa] = $aaa;
}
$this->other_blacklists = $other_blacklists;
$this->aaa = $filters_to;
$lists = Doctrine_Query::create()->select('l.name, l.id')->from('Lists l')->where('origin != ?', 'SI')->orderBy('name')->execute();
$this->lists = $lists;
$filters = Doctrine_Query::create()->select('name, description, id')->from('Filter')->where('id = ?', $request->getParameter('id'))->execute();
$this->filters = $filters;
return;
}