Answer the question
In order to leave comments, you need to log in
How to organize scope in Yii2?
public function withFullUrl($url)
{
$this->getDbCriteria()->mergeWith(array(
'condition'=>'full_url=:url',
'params'=>array(':url'=>$url)
));
return $this;
}
Answer the question
In order to leave comments, you need to log in
Start reading the docs already, this is the basis of the framework in general.
www.yiiframework.com/doc-2.0/guide-db-active-recor...
class Model extends ActiveRecord {
public static function find() {
return new MyQuery(get_called_class());
}
}
class MyQuery extends ActiveQuery {
public function withFullUrl($url) {
$this->andWhere(['full_url' => $url]);
return $this;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question