Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symfony 5 Support #1401

Open
doriangrelu opened this issue Dec 8, 2019 · 12 comments
Open

Symfony 5 Support #1401

doriangrelu opened this issue Dec 8, 2019 · 12 comments

Comments

@doriangrelu
Copy link

Bad template completion in controller and missing completion for repositories.

@Lustmored
Copy link

I have same problem, but it occurred not after upgrade to Symfony 5, but doctrine/persistence 1.3, which included deprecation of Doctrine\Common\Persistence* namespaces in favor of Doctrine\Persistence*. I believe this change could've broken completions for everything Doctrine related.

Hope this info helps a bit.

@chiqui3d
Copy link

Right, since upgrading DoctrineBundle 2 with the persistence library, it has stopped getting autocompletion on the controller.

@Haehnchen
Copy link
Owner

Haehnchen commented Dec 28, 2019

@Lustmored thanks for you feedback: For Doctrine interface changes: #1404

@doriangrelu What do you mean by "Bad template completion"?
I guess at least: #1394; i will also check if latest controller classes are included

Haehnchen added a commit that referenced this issue Dec 28, 2019
Haehnchen added a commit that referenced this issue Dec 28, 2019
Haehnchen added a commit that referenced this issue Dec 28, 2019
Support shortcuts instances of "Symfony\Bundle\FrameworkBundle\Controller\AbstractController" #1401
@Haehnchen
Copy link
Owner

hopefully i catched all methods, looks now much better via 0.19.187

@chiqui3d
Copy link

Hello @Haehnchen ,

I just updated the plugin and cleaned the cache of both PHPStorm editor and Symfony plugin using the clear index button, and I still don't have the autocomplete:

TestController.php example:

$em         = $this->getDoctrine()->getManager();
$repository = $em->getRepository(Entity::class)->Not autocompleted->customRepositoryMethod();
$query = $em->getRepository(Entity::class)->createQueryBuilder('e')->Not autocompleted->leftJoin();

@chiqui3d
Copy link

If I use $this->getDoctrine() without the getManager() it works, but it should work with getManager(), right?

@Lustmored
Copy link

I have many repositories that act as a service and therefore extends Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository, which in fact extends Doctrine\ORM\EntityRepository, that implements Doctrine\Common\Persistence\ObjectRepository which is an alias for \Doctrine\Persistence\ObjectRepository.

Long story short - two easily recognisable problems:

  • completion finds only common methods, like find, findBy and so on, which seems wrong, but minor problem
  • return types of find, findBy etc. is broken - it always finds only "object|null" instead of Entity types. This breaks inspections and typehints literally all over the place.

My reasoning is that maybe class aliases are somewhere not correctly recognized, so in mentioned ObjectRepositoryResultTypeProvider there should be. I will follow with pull request trying to match all "legacy" namespaces with their new couterpart.

I've tried to set up everything for plugin development, but failed so far, so I only know my version builds and Gradle "verifyPlugin" script runs OK.

@Lustmored
Copy link

I see there is a new version with PR merged in. After clearing indexes and running inspection throughout my rather large project there is just one or two type compatibility issues instead of hundreds that were before. Also code completion for repositories works as intended.

So at least all problems I have encountered seems fixed.

@chiqui3d
Copy link

chiqui3d commented May 5, 2020

I don't currently have an autocomplete with Doctrine.

@Marmelatze
Copy link

For me it is also still broken with Doctrine. In IDEA Ultimate (if this makes any difference)
Screenshot 2020-05-06 um 05 49 25

@sdespont
Copy link

sdespont commented May 6, 2020

Same for me with Symfony 3.4, Doctrine getRepository are no longer working with PHPStorm 2020

@Haehnchen
Copy link
Owner

issues for 2020.x are also reflect in fail tests. #1453

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants