ialable after 1.1.x.x
*/
var $beforeFilter = null;
/**
* Replaced with Router::parseExtensions();
*
* @deprecated will not be avialable after 1.1.x.x
*/
var $
webservices = null;
/**
* Constructor.
*/
function __construct() {
if ($this->name === null) {
$r = null;
if (!preg_match('/(.*)Controller/i', get_class($this), $r)) {
die ("Controller::__construct() : Can't get or parse my own class name, exiting.");
}
$this->name = $r[1];
}
if ($this->viewPath == null) {
$this->viewPath = Inflector::underscore($this->name);
}
$this->modelClass = Inflector::classify($this->name);
$this->modelKey = Inflector::underscore($this->modelClass);
if (is_subclass_of($this, 'AppController')) {
$appVars = get_class_vars('AppController');
$uses = $appVars['uses'];
$merge = array('components', 'helpers');
if ($uses == $this->uses && !empty($this->uses)) {
array_unshift($this->uses, $this->modelClass);
} elseif (!empty($this->uses)) {
$merge[] = 'uses';
}
foreach($merge as $var) {
if (isset($appVars[$var]) && !empty($appVars[$var]) && is_array($this->{$var})) {
$this->{$var} = array_merge($this->{$var}, array_diff($appVars[$var], $this->{$var}));
}
}
}
parent::__construct();
}
function _initComponents(){
$component = new Component();
$component->init($this);
}
/**
* Loads and instantiates models required by this controller.
* If Controller::persistModel; is true, controller will create cached model instances on first request,
* additional request will used cached models
*
* @return mixed true when single model found and instance created error returned if models not found.
* @access public
*/
function constructClasses() {
if($this->uses === null || ($this->uses === array())){
return false;
}
if (empty($this->passedArgs) || !isset($this->passedArgs['0'])) {
$id = false;
} else {
$id = $this->passedArgs['0'];
}
$cached = false;
$object = null;
if ($this->persistModel === true){
uses('neat_array');
}
if($this->uses === false) {
if(!class_exists($this->modelClass)){
loadModel($this->modelClass);
}
}
if (class_exists($this->modelClass) && ($this->uses === false)) {
if ($this->persistModel === true) {
$cached = $this->_persist($this->modelClass, null, $object);
}
if (($cached === false)) {
$model =& new $this->modelClass($id);
$this->modelNames[] = $this->modelClass;
$this->{$this->modelClass} =& $model;
if ($this->persistModel === true) {
$this->_persist($this->modelClass, true, $model);
$registry = ClassRegistry::getInstance();
$this->_persist($this->modelClass . 'registry', true, $registry->_objects, 'registry');
}
} else {
$this->_persist($this->modelClass . 'registry', true, $object, 'registry');
$this->_persist($this->modelClass, true, $object);
$this->modelNames[] = $this->modelClass;
}
return true;
} elseif ($this->uses === false) {
return $this->cakeError('
missingModel', array(array('className' => $this->modelClass, 'webroot' => '', 'base' => $this->base)));
}
if ($this->uses) {