Marcos
Marcos

Reputation: 4643

Generating getters and setters in Doctrine without comments

I'm using Symfony2 and Doctrine, so to create getters and setters methods I do:

php app/console doctrine:generate:entities org/StoreBundle/Entity/Product

That works fine, but I would like to generate the getters and setters without comments. I think they are too obvious and redundant, for example:

    /**
     * Get name
     *
     * @return string 
     */
    public function getName()
    { 
        return $this->name;
    }

Five lines ! Is there any option to do that?

Upvotes: 2

Views: 4654

Answers (2)

samanime
samanime

Reputation: 26547

Looking at the source for the Doctrine GenerateEntitiesCommand, it doesn't look like there is any way to do that: https://github.com/doctrine/DoctrineBundle/blob/master/Command/GenerateEntitiesDoctrineCommand.php

However, why would you want to remove the comments? It's not like there is a line limit in PHP, and it is barely a blip on your compiling in terms of a performance hit for comments (the different is so small, there is no way you could actually measure it on your computer).

Also, if you use PHPDoc to generate documentation for your code, that @return string is more useful than you might thing, because you'd then know the return types for each of your getters (which isn't always very obvious).

Upvotes: 4

pmoubed
pmoubed

Reputation: 3922

You may generate getter/setter using Netbeans IDE instead of Doctrine command line.

Upvotes: 4

Related Questions