Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caching when doctrine:generate entities? #479

Closed
ivaaaan opened this issue Nov 2, 2015 · 3 comments
Closed

Caching when doctrine:generate entities? #479

ivaaaan opened this issue Nov 2, 2015 · 3 comments
Assignees

Comments

@ivaaaan
Copy link

ivaaaan commented Nov 2, 2015

I'm have a simple entity:

<?php
/**
 * @Table(name="tickets")
 * @Entity(repositoryClass="AppBundle\Entity\TicketRepository")
 */
class Ticket 
{
   /**
     * @var \DateTime
     * @Column(type="datetime", name="created_at")
     * @Timestampable(on="create")
     */
    protected $createdAt;

    public function getCreatedAt()
    {
        return $this->createdAt;
    }

    public function setCreatedAt(\DateTime $createdAt = null)
    {
        $this->createdAt = $createdAt;
    }
}

Next I'm executing app/console doctrine:generate:entities. And add item:

$ticket = new Ticket(); 
//..
$em->flush();

If i'm not execute app/console doctrine:generate:entities - all ok, but when I do it - i got error Integrity constraint violation: 1048 Column 'created_at' cannot be null. And only when I cleared all doctrine cache - all was well

It's strange.

For fix it i'm just clear all doctrine cache:

app/console doctrine:cache:clear-result
app/console doctrine:cache:clear-query

@Ocramius
Copy link
Member

Ocramius commented Nov 2, 2015

Generating entities means also changing them (and their mappings), so this seems normal to me.

What would the expected behavior be?

@ivaaaan
Copy link
Author

ivaaaan commented Nov 2, 2015

i'm don't see changes in file.

@nicodmf
Copy link
Contributor

nicodmf commented Feb 1, 2018

@Ocramius : to close ?

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

No branches or pull requests

3 participants