Skip to content

Autocomplete for Doctrine findBy and findAll methods shows setters/getters from way too many entities #1422

Open
@MrFox42

Description

@MrFox42

In this example, I have a small application with only a few entities: Entry, EntryPicture, and User.

After writing the following code in a controller function:

$entries = $this->getDoctrine()->getRepository('App:Entry')->findAll();

autocomplete for the returned objects lists methods from Entry and EntryPicture.

If I add one more line, for example to fetch all users, it gets even messier.

$entries = $this->getDoctrine()->getRepository('App:Entry')->findAll();
$users = $this->getDoctrine()->getRepository('App:User')->findAll();

Now autocomplete lists methods from all 3 of my entities for objects from both $entries and $users.

phpstormsymfonyfindall

Using findBy results in the same problem, however find and findOneBy works fine.

I've tried this with multiple projects ranging from Symfony version 4.2 to 4.4 to make sure it's not an isolated issue.

Additional info: I have this issue in both PhpStorm 2019.3.1 and 2019.3.2 RC.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions