Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [Doctrine] transaction
angel170
post 20.06.2012, 14:25:33
Post #1





Grupa: Zarejestrowani
Postów: 16
Pomógł: 0
Dołączył: 15.04.2012

Ostrzeżenie: (0%)
-----


Witam mam problem z transakcja jak pojawi sie gdzies blad to nie wraca do stanu z przed jej wykonania

  1. $em->getConnection()->beginTransaction(); // suspend auto-commit
  2. try {
  3. $Post= new models\Entity\Post;
  4. $Post->setPostTitle('setPostTitle');
  5. $em->persist($Post);
  6.  
  7. $Post_settings = new models\Entity\Post_settings;
  8. $Post_settings->setIdPost($Post);
  9. $Post_settings->setKey(NULL);
  10. $em->persist($Post_settings);
  11.  
  12. $em->flush();
  13. $em->getConnection()->commit();
  14.  
  15. } catch (Exception $e) {
  16. $em->getConnection()->rollback();
  17. $em->close();
  18. throw $e;
  19. }

$Post_settings->setKey(NULL); wartosc nie moze byc NULL dostaje error ale do Tabeli dodje sie rekord "Post" a przeciez nie powinien skoro jest rollback o co chodzi ?

Ten post edytował angel170 20.06.2012, 14:29:02
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 19.04.2024 - 08:05