[PR #6373] Typehint @return at get method for OneToMany target #9953

Closed
opened 2026-01-22 16:05:57 +01:00 by admin · 0 comments
Owner

Original Pull Request: https://github.com/doctrine/orm/pull/6373

State: closed
Merged: No


Currently when using doctrine:generate:entityies for @ORM\OneToMany relation get method will generate as follows

    /**
     * @ORM\OneToMany(targetEntity="AppBundle\Entity\Action", mappedBy="player")
     */
    protected $actions;

    /**
     * Get actions
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getActions()
    {
        return $this->actions;
    }

Proposed change will add entity array hint as alternative for return as follows:


    /**
     * Get actions
     *
     * @return \Doctrine\Common\Collections\Collection|\AppBundle\Entity\Action[]
     */
    public function getActions()
    {
        return $this->actions;
    }
**Original Pull Request:** https://github.com/doctrine/orm/pull/6373 **State:** closed **Merged:** No --- Currently when using doctrine:generate:entityies for @ORM\OneToMany relation get method will generate as follows ``` /** * @ORM\OneToMany(targetEntity="AppBundle\Entity\Action", mappedBy="player") */ protected $actions; /** * Get actions * * @return \Doctrine\Common\Collections\Collection */ public function getActions() { return $this->actions; } ``` Proposed change will add entity array hint as alternative for return as follows: ``` /** * Get actions * * @return \Doctrine\Common\Collections\Collection|\AppBundle\Entity\Action[] */ public function getActions() { return $this->actions; } ```
admin added the pull-request label 2026-01-22 16:05:57 +01:00
admin closed this issue 2026-01-22 16:05:58 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#9953