Loading models for autocompletion using PHPDoc @property
Hello all
I have just started using PHPStorm. I am using Codeigniter framework for PHP.
I was wondering if there is a way to load methods in a Model for autocompletion using PHPDoc @property.
What I mean is ....
class abc_controller extends Controller {
/**
* @property Model1
*/
function func() {
$this->load->model("Model1"); // I am loading the model here
$result = $this->Model1->getIds();
// When I type Model1 in the statement above, it should popup
// an autocompletion box populated with all the methods of Model1
}
}
Regards
请先登录再写评论。
@property can be added only to the class phpdoc, not to the method phpdoc.
This didn't help. It shows "No Suggestions".
I added the @property to the class phpdoc. Here is how...
Do I have to add the CodeIgniter library to the include path or external libraries or something like that.
What am I doing wrong over here?
Regards
1. Of course CodeIgniter source should be included somehow (via external libraries or directly to the project, what is more convenient for you).
2. You use wrong format, the right one is:
@property type $var
That worked. :) Thanks a lot.
You can construct this as follows, so all methods in the controller have model access type hinting without IDE error. Hope this help someone: