S
S
Sergi0Limit2015-10-28 18:40:42
Yii
Sergi0Limit, 2015-10-28 18:40:42

How to add get function name to phpdoc in PhpStorm?

Greetings.
There is a handy thing in Yii2 classes called getMethdod() which is used to create logical Relations in an AR model.
So, these methods are accessed as properties by name with a small letter without the prefix get.
For example,

class Customer extends ActiveRecord
{
    public function getOrders()
    {
        return $this->hasMany(Order::className(), ['customer_id' => 'id']);
    }
}

the call happens through $model->orders;
PhpStorm only shows getOrders() through model autocomplete. You can solve it by adding a property description to phpdoc in the form
/**
* @property mixed $orders
*/

How can this business be automated or simplified? PhpStorm has the ability to generate phpdoc by function, but the information that I need is not generated and not where it is required.
Any ideas?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Makarov, 2015-10-30
@SamDark

Gii is able to generate this business together with model. PhpStorm, as far as I know, no.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question