public findModel ( string $id ) : yii\db\ActiveRecordInterface | |
||
$id | string | the ID of the model to be loaded. If the model has a composite primary key, the ID must be a string of the primary key values separated by commas. The order of the primary key values should follow that returned by the `primaryKey()` method of the model. |
return | yii\db\ActiveRecordInterface | |
the model found |
public function findModel($id)
{
if ($this->findModel !== null) {
return call_user_func($this->findModel, $id, $this);
} elseif ($this->controller->hasMethod('findModel')) {
return call_user_func([$this->controller, 'findModel'], $id, $this);
} else {
throw new InvalidConfigException('Either "' . get_class($this) . '::findModel" must be set or controller must declare method "findModel()".');
}
}