Cake\Controller\Controller::__get PHP Method

__get() public method

Magic accessor for model autoloading.
public __get ( string $name ) : boolean | object
$name string Property name
return boolean | object The model instance or false
    public function __get($name)
    {
        if (in_array($name, ['layout', 'view', 'theme', 'autoLayout', 'viewPath', 'layoutPath'], true)) {
            $method = $name === 'viewPath' ? 'templatePath' : $name;
            trigger_error(sprintf('Controller::$%s is deprecated. Use $this->viewBuilder()->%s() instead.', $name, $method), E_USER_DEPRECATED);
            return $this->viewBuilder()->{$name}();
        }
        list($plugin, $class) = pluginSplit($this->modelClass, true);
        if ($class !== $name) {
            return false;
        }
        return $this->loadModel($plugin . $class);
    }