idea-php-annotation-plugin icon indicating copy to clipboard operation
idea-php-annotation-plugin copied to clipboard

No shortcuts for "Import Class" on ORM relational mappings

Open GDIBass opened this issue 7 years ago • 0 comments

Hello,

Currently there is no option shortcuts for "Import Class" when using the Long Form of an entity class.

Example: Setup: If you have two entities in App\Entity such as App\Entity\Parent and App\Entity\Child.

Parent has the following code:

    /**
     * @ORM\OneToMany(targetEntity="App\Entity\Child\Child", mappedBy="parent")
     */
    private $children;

Child has the following code:

    /**
     * @ORM\ManyToOne(targetEntity="App\Entity\Parent\Parent", inversedBy="children")
     */
    private $parent;

I would like the option to right click the target entity had select "Import Class". The inspector would then add a use statement at the top of the file (along with all the other use statements) like:

use App\Entity\Parent\Parent;

and convert the ORM relation to

    /**
     * @ORM\ManyToOne(targetEntity="Parent", inversedBy="children")
     */
    private $parent;

I'm not very familiar with java, but I'll download the Repo and see if can't get something working! If I can I'll submit a PR and if I can't I'll let you guys know. Thanks!

GDIBass avatar Aug 14 '18 00:08 GDIBass