Problem "The EntityManager is closed."

Hello,

I have an error that occurred after declaring a service.

"The EntityManager is closed."

So I did a
echo 'Exception received: ', $e->getMessage(), "\n";
to display the exact error, and it comes from the fact that I want to enter a null value for my created_at field. However, I proceeded in the same way for the same service in another app and I never had this error..

Any ideas?

Thanks in advance.

Configuration: Windows / Chrome 53.0.2785.116

2 answers

  • Votes
  • Date
  • Descending date
  1. Moderator
    Hello,

    It's probably because you're trying to insert a NULL value into a field where "NULL" is not allowed in your database...
    Start by checking the relevant table.

    --
    Best regards,
    Jordane
    1. Yes, I know, I checked and indeed the NULL field is set to "NO", but in my other app, this same field was declared like this and it worked perfectly well :/
    2. Moderator
      @totoI can't tell you why it was bugged before and now it's not...
      because that's exactly how it should be viewed...
    3. Okay :/ I'll keep looking then .. Thanks anyway
  2. Contributor
    How is your created_at field managed?
    If it's automatic, make sure that its value is filled correctly (obviously, that's not the case since you have null)
    If it's manual, well, the same goes, enter your value manually.
    1. My created_at field is managed automatically because in my old app I didn't have to manage it.
    2. Contributor
      And what is responsible for that?

      You might have a service or something else that should take care of it but isn't working anymore.
    3. Indeed, in my services I manage all my logs and I know that it's a typical error of a problem at the service level, but I really don't see the issue because my error is simply "The EntityManager is closed."