1

I have a strange problem with PhpStorm and Symfony plugin. After having worked fine for many months, suddenly it won't recognize any Symfony method. A simple $this->getDoctrine()->getManager() won't work, since PhpStorm says "Method getDoctrine() not found". Neither $this->get("whatever").

What is the cause and how can I solve this?

4
  • 2
    Have you tried File | Invalidate Caches... and restart IDE? It's a first thing to try in "suddenly cannot resolve method" cases. Commented Jan 24, 2019 at 10:50
  • yes, but nothing changed Commented Jan 24, 2019 at 14:44
  • Does your controller extend AbstractController? Commented Jan 25, 2019 at 1:40
  • A full listing of the controller class (including use statements) could be helpful. Perhaps the issue is just because of invalid parent class Commented Jan 25, 2019 at 13:01

2 Answers 2

1

I solved the problem by searching on the Internet. Regarding this article:

https://github.com/Haehnchen/idea-php-symfony2-plugin/issues/1266

PhpStorm doesn't like many projects opened in the same window, since it doesn't know where to find the references it needs because all the projects have the same structure.
In my opinion this is very horrible programmatically speaking, I hope that JetBrains will fix this!
Thanks everybody anyway

Sign up to request clarification or add additional context in comments.

Comments

1

You can comment above a Variable if you want in php. PhpStorm will recognize it and link the classes.

For example:

/** @var Serializer $serializer */
$serializer = $this->get('jms_serializer');

1 Comment

Telling PHPStorm what is returned from the container (for namespaced classes, at least) tomasvotruba.cz/blog/2019/01/28/…

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.