本文整理汇总了PHP中CBaseActiveRelation类的典型用法代码示例。如果您正苦于以下问题:PHP CBaseActiveRelation类的具体用法?PHP CBaseActiveRelation怎么用?PHP CBaseActiveRelation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CBaseActiveRelation类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mergeWith
public function mergeWith($criteria, $fromScope = false)
{
if ($criteria instanceof CDbCriteria) {
$criteria = $criteria->toArray();
}
if ($fromScope) {
if (isset($criteria['condition']) && $this->on !== $criteria['condition']) {
if ($this->on === '') {
$this->on = $criteria['condition'];
} elseif ($criteria['condition'] !== '') {
$this->on = "({$this->on}) AND ({$criteria['condition']})";
}
}
unset($criteria['condition']);
}
parent::mergeWith($criteria);
if (isset($criteria['joinType'])) {
$this->joinType = $criteria['joinType'];
}
if (isset($criteria['on']) && $this->on !== $criteria['on']) {
if ($this->on === '') {
$this->on = $criteria['on'];
} elseif ($criteria['on'] !== '') {
$this->on = "({$this->on}) AND ({$criteria['on']})";
}
}
if (isset($criteria['with'])) {
$this->with = $criteria['with'];
}
if (isset($criteria['alias'])) {
$this->alias = $criteria['alias'];
}
if (isset($criteria['together'])) {
$this->together = $criteria['together'];
}
}
示例2: mergeWith
/**
* Merges this relation with a criteria specified dynamically.
* @param array the dynamically specified criteria
* @since 1.0.5
*/
public function mergeWith($criteria)
{
parent::mergeWith($criteria);
if (isset($criteria['joinType'])) {
$this->joinType = $criteria['joinType'];
}
if (isset($criteria['on']) && $this->on !== $criteria['on']) {
if ($this->on === '') {
$this->on = $criteria['on'];
} else {
if ($criteria['on'] !== '') {
$this->on = "({$this->on}) AND ({$criteria['on']})";
}
}
}
if (isset($criteria['with'])) {
$this->with = $criteria['with'];
}
if (isset($criteria['alias'])) {
$this->alias = $criteria['alias'];
}
if (isset($criteria['together'])) {
$this->together = $criteria['together'];
}
}