gvgvgvijayan
gvgvgvijayan

Reputation: 2506

Yii2 autocomplete chain of methods in netbeans

In netbeans I already installed yii2 plugin, my query was how to make autocomplete for method chaining too. Because here in the below code

$query = Message::find()->orderBy('name')->

After the second object operator (->) autocomplete not working.

So How we can achieve autocomplete for chain of methods in netbeans with yii2.

Upvotes: 0

Views: 790

Answers (1)

lennartvdd
lennartvdd

Reputation: 505

I don't think you can without changing the Yii framework code (not recommended).

Autocomplete does not work properly on the orderBy() method, most likely because it's using phpdoc @return $this. Seems NetBeans prefers the use of the keyword this instead of $this (Also see: NetBeans bug#239987) but changing it in the framework code didn't work for me either. It worked when I changed it to static though.

This might also be related to NetBeans bug#196565

Alternatively you could use inline type hinting:

$query = Message::find()->orderBy('name');
/* @var $query \yii\db\ActiveQuery */

but I usually just grab the docs to prevent cluttering up the code. (Having 2 monitors helps)

Upvotes: 3

Related Questions