GeneratorBundle icon indicating copy to clipboard operation
GeneratorBundle copied to clipboard

Expecting fluent design pattern on every setter methods

Open jibundeyare opened this issue 8 years ago • 0 comments

When I add a *ToMany association mapping on the Tag class, between Tag and Post classes, the generator creates a remove*() method wich does not return $this :

    /**
     * Remove post
     *
     * @param \AppBundle\Entity\Post $post
     */
    public function removePost(\AppBundle\Entity\Post $post)
    {
        $this->posts->removeElement($post);
    }

This is better :

    /**
     * Remove post
     *
     * @param \AppBundle\Entity\Post $post
     *
     * @return Tag
     */
    public function removePost(\AppBundle\Entity\Post $post)
    {
        $this->posts->removeElement($post);

        return $this;
    }

jibundeyare avatar Nov 12 '17 23:11 jibundeyare