Someone recommended I “use code completion” and I realized that while my IDE has code completion, it doesn’t recognize the large majority of methods and variables inherited from CakePHP’s framework, most notably the Helper methods for views. I’m using PhpED but it seems like it’s code completion is supposed to work just as it does in eclipse and other editors.
I followed this advice to no avail; I created a helpers.php file with definitions of all the helpers and included it in the project but the code completion still doesn’t work with the Helpers.
I think part of the problem is Mark Story’s post is from an old version of cake (I am on Cake 1.3) so I updated the definitions of the Helpers to look like this:
$this->Form = new FormHelper();
But there’s still no code completion for any of the views. Is there any way to make this work? In addition to the Helpers I’d really like completion for functions like Model->find() but those don’t work either.
For PhpED you have to do the following to enable Autocompletion for $this.
Lets say you want to use $this in a Controller for something like this
First add this PhpDoc tag before the class definition
Now typing $this->Project should work as intended.
Next up is the Project model class.
In here add the following code, again before the class definition
Now $this->Project->Country->getCountryName($countryId) works. The method is not 100% as i would like it, as PhpEDs Autocompletion sorts alphabetically, so any class starting with A or B will be shown before the methods of the Country mode.