I got accustomed to using PHPStorm's validation feature, the yellow flags on right of editor showing whenever a method could not be found.

I found that it doesn't recognize magic getter methods, for instance: $attribute->getAttributeCode().

Anyone ever made this work ?

Thank you.

3 Answers 3


most of the issues get resolved if you use n98-magerun to generate the phpstorm meta file https://github.com/netz98/n98-magerun#development-ide-support

If there are cases where this does not happen correctly, please report them, so it can get extended :)


You should give magicento a try, it adds a lot of typehints. But I'm not sure on what bases, maybe hard coded, retrieved from the tables?

Beside this, you can define the methods and properties on the class:

  * @property Classname $_name
  * @method Returned_Class methodName(TypeHint $typehint, TypeHint2 $typehint2) And a comment to describe what the method does
class MyClass {}

But both methods are not useable for bad commented core classes :-/

  • I already use magicento. It doesn't resolve either, neither cmd+b goes to the property.
    – Niloct
    Commented Apr 9, 2014 at 21:15
  • That @method wouldn't be bad since I would have to declare again all methods which are supposed to be magic ?
    – Niloct
    Commented Apr 9, 2014 at 21:16
  • The problem with magic method is the magic part :D There is no way to determine, what method exists and which doesn't. You can write an code generator which adds all the tables to the classes, but you still don't know what methods are missing... Commented Apr 9, 2014 at 21:32
  • 1
    Suppose I have an object with class known, wouldn't it just simply needed to walk through the properties of the class and apply the magic transformation to find getters ?
    – Niloct
    Commented Apr 10, 2014 at 19:12
  • 2
    Follow this steps to get autocomplete for magic methods without adding @method phpdocs: magicento.com/#magic-method-autocomplete (how Fabian said, Magicento is reading your DB to guess the properties of your model)
    – Enrique
    Commented Apr 21, 2014 at 20:58

It’s not a perfect solution, but there is a workaround that is good enough for me. Essentially, you can make PHPStorm downgrade the warning by toggling this option. Preferences > Editor > Inspections > Undefined > Undefined method

  • Thanks for your answer but I've moved on from Magento and PHP years ago.
    – Niloct
    Commented Oct 30, 2020 at 13:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.