0
votes

I hope this question haven't already answered but i don't find it.

I using doctrine2 in my symfony (3.4) project. I use persist and flush so many times into it without any problems throught container, in a little piece of code i have some trouble i can't figure out...

In my controller i have a code like this :

            $obj = $this->container->get('some.service')->initiateObj(some_params);
            $this->getManager()->persist($obj);
            $this->getManager()->flush();
// I can't dump here

My object is set and returned correctly from my first code line. The persist function work perfectly. If i dump my object after persist, doctrine event setting for this object right sets.

After the flush i have an error 500 from my browser (chromium).

I was thinking the problem were in a pre/postFlush event, but when a dump in doctrine EntityManager code, the unitOfWork->commit function work correctly without error and i can dump after it.

But i can't dump in my controller just after flush...

Here the EntityManager from doctrine code :

public function flush($entity = null)
{
    $this->errorIfClosed();

    $this->unitOfWork->commit($entity);
    // I can dump here
}

I haven't any symfony/doctrine log from that, no apache2 log too.

Is anyone have an idea from where an error can throw after the commit function ?

Thank you very much for your help !

1
Do you have a stacktrace ?Jeroen
Go to the debug panel :)zalex
I don't have any exception raised, and i have an error 500, i don't have debug toolbar/panel unfortunately.EhXod
Are you using the dev environment ?Jeroen
Yeah for sure ! The problem apparently is in my code and i try to resolve it actually. But i don't understand why i haven't any stacktrace, log or exception thrown. Just a 500 error message in my browser.EhXod

1 Answers

0
votes

I have found my solution last week, in my code.

It was in postPersist event. But i don't really understand why symfony, doctrine... raise any exception, just a blank screen with an error 500.

Thanks you for your help.