yii\test\BaseActiveFixture::getModel PHP Метод

getModel() публичный Метод

A model name is the key of the corresponding data row in [[data]].
public getModel ( string $name ) : null | ActiveRecord
$name string the model name.
Результат null | yii\db\ActiveRecord the AR model, or null if the model cannot be found in the database
    public function getModel($name)
    {
        if (!isset($this->data[$name])) {
            return null;
        }
        if (array_key_exists($name, $this->_models)) {
            return $this->_models[$name];
        }
        if ($this->modelClass === null) {
            throw new InvalidConfigException('The "modelClass" property must be set.');
        }
        $row = $this->data[$name];
        /* @var $modelClass \yii\db\ActiveRecord */
        $modelClass = $this->modelClass;
        /* @var $model \yii\db\ActiveRecord */
        $model = new $modelClass();
        $keys = [];
        foreach ($model->primaryKey() as $key) {
            $keys[$key] = isset($row[$key]) ? $row[$key] : null;
        }
        return $this->_models[$name] = $modelClass::findOne($keys);
    }