app/console doctrine:generate:entities overrides Gedmo\Timestampable\Traits\TimestampableEntity trait #7513

Closed
pamil opened this Issue Mar 28, 2013 · 2 comments

Projects

None yet

2 participants

@pamil

I'm using gedmo/doctrine-extensions, but I think, that error is related to Symfony2's console tool.
I have entity called User, eg.

use Gedmo\Timestampable\Traits\TimestampableEntity;

class User
{
    use TimestampableEntity;

    [...]
}

And when I'm running php app/console doctrine:generate:entities MyBundle, I got:

use Gedmo\Timestampable\Traits\TimestampableEntity;

class User
{
    use TimestampableEntity;

    [...]

    /**
     * @var \DateTime
     */
    private $createdAt;

    /**
     * @var \DateTime
     */
    private $updatedAt;


    /**
     * Set createdAt
     *
     * @param \DateTime $createdAt
     * @return User
     */
    public function setCreatedAt($createdAt)
    {
        $this->createdAt = $createdAt;

        return $this;
    }

    /**
     * Get createdAt
     *
     * @return \DateTime 
     */
    public function getCreatedAt()
    {
        return $this->createdAt;
    }

    /**
     * Set updatedAt
     *
     * @param \DateTime $updatedAt
     * @return User
     */
    public function setUpdatedAt($updatedAt)
    {
        $this->updatedAt = $updatedAt;

        return $this;
    }

    /**
     * Get updatedAt
     *
     * @return \DateTime 
     */
    public function getUpdatedAt()
    {
        return $this->updatedAt;
}

I got this trait pasted directly in my Entity, when I don't want to get these lines :(

@stof
Symfony member

The EntityGenerator is not provided by Symfony but by the Doctrine ORM. And this is a known bug. See doctrine/doctrine2#632 for the fix

@stof stof closed this Mar 28, 2013
@pamil

Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment