本文整理汇总了PHP中yii\db\ActiveQuery::where方法的典型用法代码示例。如果您正苦于以下问题:PHP ActiveQuery::where方法的具体用法?PHP ActiveQuery::where怎么用?PHP ActiveQuery::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\db\ActiveQuery
的用法示例。
在下文中一共展示了ActiveQuery::where方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getActiveToken
public static function getActiveToken($token)
{
$activeQuery = new ActiveQuery(self::className());
$activeQuery->where('access_token = :token', [':token' => $token]);
$activeQuery->andWhere('expires > now()');
$token = $activeQuery->one();
return $token;
}
示例2: activeByNameDecoded
/**
* @inheritdoc
* @return Parametro|array|null
*/
public function activeByNameDecoded($name, $db = null)
{
$ret = parent::where(['nombre' => $name])->andWhere('fecha_fin is null')->one();
if (!$ret) {
return null;
}
return Json::decode($ret->valor);
}
示例3: catering
/**
* Set catering parameters.
*
* @param null $db
* @param array $values
*/
public function catering($db = null, $values)
{
/** @var Settings $row */
$row = parent::where(['key' => 'catering'])->one($db);
$newValue = json_encode($values);
if (false === $newValue) {
Yii::error(__METHOD__ . '=> `json_encode` failed!');
return;
}
$this->createOrUpdateSettings($row, 'catering', $newValue);
}
示例4: findProfile
/**
* Finds a profile.
*
* @param mixed $condition
*
* @return \yii\db\ActiveQuery
*/
public function findProfile($condition)
{
return $this->profileQuery->where($condition);
}
示例5: catering
/**
* Get catering settings as array.
*
* @param null $db
* @return array|null
*/
public function catering($db = null)
{
/** @var Settings $row */
$row = parent::where(['key' => 'catering'])->one($db);
return is_null($row) ? ['host' => '', 'bank_id' => '', 'password' => '', 'use_account_type' => false] : json_decode($row->value, true);
}
示例6: countProductsForOrder
public function countProductsForOrder($id)
{
return parent::where(['order_id' => $id])->count();
}
示例7: findComment
/**
* Finds a category by the given condition.
*
* @param mixed $condition Condition to be used on search.
*
* @return \yii\db\ActiveQuery
*/
public function findComment($condition)
{
return $this->commentQuery->where($condition);
}
示例8: getTaskModel
public static function getTaskModel($id)
{
if (!isset($id)) {
return false;
}
$query = new ActiveQuery(new Task());
return $query->where(['id' => $id])->one();
}
示例9: getSubtasks
public function getSubtasks()
{
$query = new ActiveQuery(new Task());
return $query->where(['projectID' => $this->projectID, 'parenttask' => $this->id])->all();
}
示例10: findNoteById
public function findNoteById($id)
{
return $this->noteQuery->where(['id' => $id])->one();
}
示例11: findUserType
/**
* Finds a user type.
*
* @param mixed $condition
*
* @return \yii\db\ActiveQuery
*/
public function findUserType($condition)
{
return $this->userTypeQuery->where($condition);
}
示例12: findPage
/**
* Finds a page by the given condition.
*
* @param mixed $condition Condition to be used on search.
*
* @return \yii\db\ActiveQuery
*/
public function findPage($condition)
{
return $this->pageQuery->where($condition);
}
示例13: findBlock
/**
* Finds a page by the given condition.
*
* @param mixed $condition Condition to be used on search.
*
* @return \yii\db\ActiveQuery
*/
public function findBlock($condition)
{
return $this->blockQuery->where($condition);
}