Commit e13557d3 by Qiang Xue

doc fix.

parent 31c24ec9
...@@ -100,7 +100,6 @@ class ExistValidator extends Validator ...@@ -100,7 +100,6 @@ class ExistValidator extends Validator
$targetClass = $this->targetClass === null ? get_class($object) : $this->targetClass; $targetClass = $this->targetClass === null ? get_class($object) : $this->targetClass;
$query = $this->createQuery($targetClass, $params); $query = $this->createQuery($targetClass, $params);
/** @var \yii\db\ActiveRecordInterface $className */
if (!$query->exists()) { if (!$query->exists()) {
$this->addError($object, $attribute, $this->message); $this->addError($object, $attribute, $this->message);
} }
...@@ -126,6 +125,12 @@ class ExistValidator extends Validator ...@@ -126,6 +125,12 @@ class ExistValidator extends Validator
return $query->exists() ? null : [$this->message, []]; return $query->exists() ? null : [$this->message, []];
} }
/**
* Creates a query instance with the given condition.
* @param string $targetClass the target AR class
* @param mixed $condition query condition
* @return \yii\db\ActiveQueryInterface the query instance
*/
protected function createQuery($targetClass, $condition) protected function createQuery($targetClass, $condition)
{ {
/** @var \yii\db\ActiveRecordInterface $targetClass */ /** @var \yii\db\ActiveRecordInterface $targetClass */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment