NOTE All of my awesome Yii code is freely available on bitbucket in the repositories here and here . If you hate the Yii verbosity, check out the Pii class. I think you will dig it out completely.
I came across this, and what I am doing is increasing phpdoc for the static model () method. This fixes the problem and autocomplete works fine.
For instance:
class MyModel extends CActiveRecord { public static function model($className=__CLASS__) { .... yada yada yada ... } }
Pay attention to the channel and additional class added to "@return". This suggests that PhpStorm also includes this class in automatic search termination.
One more note: if you use namespaces, you may need a slash in front of class names. Just depends on your project and includes.
================ UPDATE: 2013-08-05 ================
With PhpStorm v6 and above, it looks like you can use:
* * @return $this *
And also get the right auto-complete.
On the side of the note, the entire static thing of the "model ()" method is deprecated (for example, Yii), and I have a base model class that I use now for all projects. It contains a static model method; which is then no longer required in each of my subclasses. Here is an example ...
<?php namespace My\Awesome\Name\Space; class MyBaseModel extends \CActiveRecord { public static function model( $className = null ) { return parent::model( $className ? : \get_called_class() ); }
Autocomplete works fine for all subclasses ...
Just thought I was updating this and letting you know.
source share