JDare / ClankBundle

A Symfony2 Bundle for use with Ratchet WebSocket Server
MIT License
131 stars 31 forks source link

Doctrine persist on RPC #32

Open NaxYo opened 10 years ago

NaxYo commented 10 years ago

Hi!, I'm trying to persist some entity in a RPC service, I have passed the entity manager and I'm able to make queries, so it's working, but when I try to persist some entity it don't work, I'm not getting any error, but the flush order never ends...

    echo 'pre flush ';
    $this->em->flush();
    echo 'post flush '; // never shown

I believe I have some close error to this one, once I was trying to persist on a postpersist cycle event, but in this case I'm not getting any error, so I got no idea whats wrong... any idea?

NaxYo commented 10 years ago

Workaround:

    $conn = $this->em->getConnection();

    $sql = "
      INSERT INTO ...(...)
      VALUES(...)
    ";
    $stmt = $conn->prepare($sql);
    $stmt->bindValue(':somevalue', ...);
    ....
    $result = $stmt->execute();

it's a very poor solution, if anyone can find out how to do it properly with flush it will be great...