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

Returns a named Model object
public getModel ( string $name = null, array $config = [] ) : Model
$name string The Model name. If null we'll use the modelName variable or, if it's empty, the same name as the Controller
$config array Configuration parameters to the Model. If skipped we will use $this->config
Результат FOF30\Model\Model The instance of the Model known to this Controller
Пример #1
0
 /**
  * Returns a named Model object. Makes sure that the Model is a database-aware model, throwing an exception
  * otherwise, when $name is null.
  *
  * @param   string $name     The Model name. If null we'll use the modelName
  *                           variable or, if it's empty, the same name as
  *                           the Controller
  * @param   array  $config   Configuration parameters to the Model. If skipped
  *                           we will use $this->config
  *
  * @return  DataModel  The instance of the Model known to this Controller
  *
  * @throws  NotADataModel  When the model type doesn't match our expectations
  */
 public function getModel($name = null, $config = array())
 {
     $model = parent::getModel($name, $config);
     if (is_null($name) && !$model instanceof DataModel) {
         throw new NotADataModel('Model ' . get_class($model) . ' is not a database-aware Model');
     }
     return $model;
 }