Any Luck with PhpStorm?

We’ve committed to using PhpStorm on our Yii project, and it works well for the most part. We still haven’t figured out how to get some things recognized, and they keep being flagged as undefined. Here are some of the things:

Yii::import()

$this->render()

$member->last_name (where $member was created as new Member model)

The $this->render() is a problem with following the inheritance, while the $member->last_name seems to be related to failing to follow the Yii:import().

Is anyone else using PhpStorm more successfully than we are?

Thanks in advance.

Delete yiilite.php. I’ve already created an issue to allow removing a single file from a project but it needs more votes.

I should have mentioned that I had already done that. It helps a bit, but the cases I mentioned are still a problem.

Im wondering if you have had any update with this? Im currently using Idea 10.5 . Like the OP i have some basic autocomplete but its not nearly as good as it is with netbeans. I just like idea too much more to give it up. Im wondering if theres a way we could have the ide auto import the models/controllers/views to help with auto completion.

Yes, JetBrains resolved this issue so following wiki page will help: http://www.yiiframework.com/wiki/92/configuring-phpstorm-ide-for-yii

queej, were you able to get those things recognized? I have not been able to even after following the instructions samdark links to.

Is the yii folder supposed to be under the webroot for this to work? I included it as an external library, but step #2 says to exclude a directory inside the yii folder, which I don’t see on my directories settings page.

Hi Emma,

We were able to get most things recognized, but not all. I have my projects set up so that the framework directory is the top level.

We created a file called "accessors.php" that explicitly states types for some commonly used things that were not being recognized:




/**

 * @return CWebApplication

 */

function getWebApp() {

	return Yii::app();

}


/**

 * @return string

 */

function getAppParam( $param ) {

	return Yii::app()->params[$param];

}


/**

 * @return CDbConnection

 */

function getCentralDb() {

	return getWebApp()->getDb();

}

/**

 * @return WebMember

 */

function getUser() {

	return getWebApp()->getUser();

}



In each of our view files we will declare the variables at the top. E.g.,

/**

  • @var $this MyController (or simply Controller)

*/

Hope this helps a little. If we find any better way to do it, we’ll post it here.

Cheers,

-Dave