I would like Zend Studio to recognize the class type for all the controller's models, in a CakePHP 2.x project.
This is how I currently do it.
class MyController extends AppController
{
public $uses = array('Scan');
public function index()
{
/* @var $scan Scan */
$scan = $this->Scan;
// do stuff...
}
}
The above works fine, and Zend will refactor all references to the Scan class correctly, but this is a pain because it has to be done in every action.
I'd like to do this instead.
class MyController extends AppController
{
public $uses = array('Scan');
/** @var Scan */
public $Scan;
public function index()
{
// do stuff...
$this->Scan->.....
}
}
When I tried to declare it as a property then $this->Scan is null
, and Cake isn't loading the model.
Is there a way to declare it as a property with a phpDoc type without breaking CakePHP?