Okay I found my mistake. I missunderstood flush and commit.

My solution is:

$em->beginTransaction();
> try {
>   $em->delete($entity);
>   $em->flush();
>   // Create object
>   ...
>   $em->persists($newEntity);
>   $em->commit();
> } catch (\Exception $ex) {
>   $em->rollback();
> }


Thanks for all hints! :)

Am Donnerstag, 7. August 2014 00:31:24 UTC+2 schrieb Marcel Steves:
>
> So there is no possibility to implement my way?
> Can I do it on another way like using cache or similar?
>
> Am Mittwoch, 6. August 2014 18:31:25 UTC+2 schrieb Christophe COEVOET:
>>
>> Le 06/08/2014 18:10, Marcel Steves a écrit : 
>> > To summarize it as transaction: 
>> > 
>> > - Delete entity 
>> > - Create new entity (which triggers a validation searching for 
>> > existenz of the same entity) 
>> > - Commit 
>> > 
>> > In step 2 I need the isolation level read uncommitted. 
>> > Perhaps there is a better way using ORM but I don't know it. 
>> > 
>> But $em->remove() does not trigger any uncommented SQL query. It only 
>> tells the ORM that the entity should be removed during the next flush. 
>> The SQL DELETE query is done inside flush(). 
>>
>> -- 
>> Christophe | Stof 
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to