Browse Source

Retrait de Doctrine->getEntitymanager() pour le remplacer par Doctrine->getManager()

Bastien Sevajol 10 years ago
parent
commit
5058d626cd
27 changed files with 170 additions and 170 deletions
  1. 8 8
      src/Muzich/AdminBundle/Controller/Moderate_comment/EditController.php
  2. 7 7
      src/Muzich/AdminBundle/Controller/Moderate_element/EditController.php
  3. 3 3
      src/Muzich/AdminBundle/Controller/Moderate_tag/EditController.php
  4. 8 8
      src/Muzich/AdminBundle/Controller/Moderate_user/EditController.php
  5. 10 10
      src/Muzich/CommentBundle/Controller/CommentController.php
  6. 8 8
      src/Muzich/CoreBundle/Controller/CoreController.php
  7. 22 22
      src/Muzich/CoreBundle/Controller/ElementController.php
  8. 2 2
      src/Muzich/CoreBundle/Controller/SearchController.php
  9. 20 20
      src/Muzich/CoreBundle/Tests/Controller/ElementControllerTest.php
  10. 28 28
      src/Muzich/CoreBundle/Tests/Controller/EventTest.php
  11. 3 3
      src/Muzich/CoreBundle/Tests/Controller/FavoriteControllerTest.php
  12. 1 1
      src/Muzich/CoreBundle/Tests/Controller/HomeControllerTest.php
  13. 2 2
      src/Muzich/CoreBundle/Tests/Controller/IndexControllerTest.php
  14. 2 2
      src/Muzich/CoreBundle/Tests/Controller/ReputationTest.php
  15. 2 2
      src/Muzich/CoreBundle/Tests/Controller/ShowControllerTest.php
  16. 1 1
      src/Muzich/CoreBundle/Tests/Controller/UserControllerTest.php
  17. 8 8
      src/Muzich/CoreBundle/Tests/Tag/TagReadTest.php
  18. 12 12
      src/Muzich/CoreBundle/Tests/Tag/TagWriteTest.php
  19. 1 1
      src/Muzich/CoreBundle/Tests/User/UserTest.php
  20. 1 1
      src/Muzich/CoreBundle/lib/Controller.php
  21. 2 2
      src/Muzich/CoreBundle/lib/FunctionalTest.php
  22. 5 5
      src/Muzich/CoreBundle/lib/UnitTest.php
  23. 2 2
      src/Muzich/FavoriteBundle/Controller/FavoriteController.php
  24. 3 3
      src/Muzich/GroupBundle/Controller/DefaultController.php
  25. 2 2
      src/Muzich/HomeBundle/Controller/ShowController.php
  26. 2 2
      src/Muzich/MynetworkBundle/Controller/MynetworkController.php
  27. 5 5
      src/Muzich/UserBundle/Controller/UserController.php

+ 8 - 8
src/Muzich/AdminBundle/Controller/Moderate_comment/EditController.php View File

@@ -30,10 +30,10 @@ class EditController extends BaseController
30 30
     $element->setComments($cm->get());
31 31
     $element->setCountCommentReport($cm->countCommentAlert());
32 32
     
33
-    $this->getDoctrine()->getEntityManager()->persist($element);
33
+    $this->getDoctrine()->getManager()->persist($element);
34 34
     
35 35
     // On récupère les user qui ont signalés ce commentaire
36
-    $users = $this->getDoctrine()->getEntityManager()
36
+    $users = $this->getDoctrine()->getManager()
37 37
       ->createQuery('
38 38
         SELECT u FROM MuzichCoreBundle:User u
39 39
         WHERE u.id IN (:uids)'
@@ -46,10 +46,10 @@ class EditController extends BaseController
46 46
     foreach ($users as $user)
47 47
     {
48 48
       $user->addBadReport();
49
-      $this->getDoctrine()->getEntityManager()->persist($user);
49
+      $this->getDoctrine()->getManager()->persist($user);
50 50
     }
51 51
     
52
-    $this->getDoctrine()->getEntityManager()->flush();
52
+    $this->getDoctrine()->getManager()->flush();
53 53
     
54 54
     if (!$this->getRequest()->isXmlHttpRequest())
55 55
     {
@@ -78,16 +78,16 @@ class EditController extends BaseController
78 78
     
79 79
     // On récupère l'auteur du commentaire pour lui incrémenté son compteur
80 80
     // de contenu modéré
81
-    $user = $this->getDoctrine()->getEntityManager()->getRepository('MuzichCoreBundle:User')
81
+    $user = $this->getDoctrine()->getManager()->getRepository('MuzichCoreBundle:User')
82 82
       ->findOneBy(array(
83 83
         'id' => $comment['u']['i']
84 84
       ));
85 85
     
86 86
     $user->addModeratedCommentCount();
87 87
     
88
-    $this->getDoctrine()->getEntityManager()->persist($user);
89
-    $this->getDoctrine()->getEntityManager()->persist($element);
90
-    $this->getDoctrine()->getEntityManager()->flush();
88
+    $this->getDoctrine()->getManager()->persist($user);
89
+    $this->getDoctrine()->getManager()->persist($element);
90
+    $this->getDoctrine()->getManager()->flush();
91 91
     
92 92
     if (!$this->getRequest()->isXmlHttpRequest())
93 93
     {

+ 7 - 7
src/Muzich/AdminBundle/Controller/Moderate_element/EditController.php View File

@@ -26,9 +26,9 @@ class EditController extends BaseEditController
26 26
     $user_ids = $element->getReportIds();
27 27
     $element->setReportIds(null);
28 28
     $element->setCountReport(null);
29
-    $this->getDoctrine()->getEntityManager()->persist($element);
29
+    $this->getDoctrine()->getManager()->persist($element);
30 30
     
31
-    $users = $this->getDoctrine()->getEntityManager()
31
+    $users = $this->getDoctrine()->getManager()
32 32
       ->createQuery('
33 33
         SELECT u FROM MuzichCoreBundle:User u
34 34
         WHERE u.id IN (:uids)'
@@ -40,10 +40,10 @@ class EditController extends BaseEditController
40 40
     foreach ($users as $user)
41 41
     {
42 42
       $user->addBadReport();
43
-      $this->getDoctrine()->getEntityManager()->persist($user);
43
+      $this->getDoctrine()->getManager()->persist($user);
44 44
     }
45 45
     
46
-    $this->getDoctrine()->getEntityManager()->flush();
46
+    $this->getDoctrine()->getManager()->flush();
47 47
     
48 48
     $this->get('session')->setFlash('success', $this->get('translator')->trans("object.edit.success", array(), 'Admingenerator') );
49 49
     return new RedirectResponse($this->generateUrl("Muzich_AdminBundle_Moderate_element_list" ));
@@ -56,9 +56,9 @@ class EditController extends BaseEditController
56 56
     $event->elementRemoved($element);
57 57
     $element->getOwner()->addModeratedElementCount();
58 58
     
59
-    $this->getDoctrine()->getEntityManager()->persist($element->getOwner());
60
-    $this->getDoctrine()->getEntityManager()->remove($element);
61
-    $this->getDoctrine()->getEntityManager()->flush();
59
+    $this->getDoctrine()->getManager()->persist($element->getOwner());
60
+    $this->getDoctrine()->getManager()->remove($element);
61
+    $this->getDoctrine()->getManager()->flush();
62 62
     
63 63
     $this->get('session')->setFlash('success', $this->get('translator')->trans("object.edit.success", array(), 'Admingenerator') );
64 64
     return new RedirectResponse($this->generateUrl("Muzich_AdminBundle_Moderate_element_list" ));

+ 3 - 3
src/Muzich/AdminBundle/Controller/Moderate_tag/EditController.php View File

@@ -53,7 +53,7 @@ class EditController extends BaseEditController
53 53
     
54 54
     $uids = json_decode($tag->getPrivateids(), true);
55 55
     
56
-    $users = $this->getDoctrine()->getEntityManager()
56
+    $users = $this->getDoctrine()->getManager()
57 57
       ->createQuery('
58 58
         SELECT u FROM MuzichCoreBundle:User u
59 59
         WHERE u.id IN (:uids)'
@@ -65,10 +65,10 @@ class EditController extends BaseEditController
65 65
     foreach ($users as $user)
66 66
     {
67 67
       $user->addModeratedTagCount();
68
-      $this->getDoctrine()->getEntityManager()->persist($user);
68
+      $this->getDoctrine()->getManager()->persist($user);
69 69
     }
70 70
     
71
-    $this->getDoctrine()->getEntityManager()->flush();
71
+    $this->getDoctrine()->getManager()->flush();
72 72
     
73 73
     if (!$this->getRequest()->isXmlHttpRequest())
74 74
     {

+ 8 - 8
src/Muzich/AdminBundle/Controller/Moderate_user/EditController.php View File

@@ -56,10 +56,10 @@ class EditController extends BaseController
56 56
     $element->setComments($cm->get());
57 57
     $element->setCountCommentReport($cm->countCommentAlert());
58 58
     
59
-    $this->getDoctrine()->getEntityManager()->persist($element);
59
+    $this->getDoctrine()->getManager()->persist($element);
60 60
     
61 61
     // On récupère les user qui ont signalés ce commentaire
62
-    $users = $this->getDoctrine()->getEntityManager()
62
+    $users = $this->getDoctrine()->getManager()
63 63
       ->createQuery('
64 64
         SELECT u FROM MuzichCoreBundle:User u
65 65
         WHERE u.id IN (:uids)'
@@ -72,10 +72,10 @@ class EditController extends BaseController
72 72
     foreach ($users as $user)
73 73
     {
74 74
       $user->addBadReport();
75
-      $this->getDoctrine()->getEntityManager()->persist($user);
75
+      $this->getDoctrine()->getManager()->persist($user);
76 76
     }
77 77
     
78
-    $this->getDoctrine()->getEntityManager()->flush();
78
+    $this->getDoctrine()->getManager()->flush();
79 79
     
80 80
     if (!$this->getRequest()->isXmlHttpRequest())
81 81
     {
@@ -104,16 +104,16 @@ class EditController extends BaseController
104 104
     
105 105
     // On récupère l'auteur du commentaire pour lui incrémenté son compteur
106 106
     // de contenu modéré
107
-    $user = $this->getDoctrine()->getEntityManager()->getRepository('MuzichCoreBundle:User')
107
+    $user = $this->getDoctrine()->getManager()->getRepository('MuzichCoreBundle:User')
108 108
       ->findOneBy(array(
109 109
         'id' => $comment['u']['i']
110 110
       ));
111 111
     
112 112
     $user->addModeratedCommentCount();
113 113
     
114
-    $this->getDoctrine()->getEntityManager()->persist($user);
115
-    $this->getDoctrine()->getEntityManager()->persist($element);
116
-    $this->getDoctrine()->getEntityManager()->flush();
114
+    $this->getDoctrine()->getManager()->persist($user);
115
+    $this->getDoctrine()->getManager()->persist($element);
116
+    $this->getDoctrine()->getManager()->flush();
117 117
     
118 118
     if (!$this->getRequest()->isXmlHttpRequest())
119 119
     {

+ 10 - 10
src/Muzich/CommentBundle/Controller/CommentController.php View File

@@ -79,8 +79,8 @@ class CommentController extends Controller
79 79
     // Event pour user d'un nouveau comment
80 80
     $event->commentAdded($element, $this->getUser());
81 81
 
82
-    $this->getDoctrine()->getEntityManager()->persist($element);
83
-    $this->getDoctrine()->getEntityManager()->flush();
82
+    $this->getDoctrine()->getManager()->persist($element);
83
+    $this->getDoctrine()->getManager()->flush();
84 84
 
85 85
     // On récupère le html du li avec le comment pour la réponse
86 86
     $html = $this->render('MuzichCommentBundle:Comment:li.comment.html.twig', array(
@@ -139,8 +139,8 @@ class CommentController extends Controller
139 139
     // Si tout c'est bien passé on met a jour l'attribut de l'élément
140 140
     $element->setComments($cm->get());
141 141
       
142
-    $this->getDoctrine()->getEntityManager()->persist($element);
143
-    $this->getDoctrine()->getEntityManager()->flush();
142
+    $this->getDoctrine()->getManager()->persist($element);
143
+    $this->getDoctrine()->getManager()->flush();
144 144
     
145 145
     return $this->jsonResponse(array(
146 146
       'status' => 'success'
@@ -260,8 +260,8 @@ class CommentController extends Controller
260 260
     $cm->update($this->getUser(), $date, $comment, $follow);
261 261
     $element->setComments($cm->get());
262 262
 
263
-    $this->getDoctrine()->getEntityManager()->persist($element);
264
-    $this->getDoctrine()->getEntityManager()->flush();
263
+    $this->getDoctrine()->getManager()->persist($element);
264
+    $this->getDoctrine()->getManager()->flush();
265 265
         
266 266
     if (null === ($comment_index = $cm->getIndex($this->getUserId(), $date)))
267 267
     {
@@ -321,8 +321,8 @@ if (($non_condition = $this->userHaveNonConditionToMakeAction(SecurityContext::A
321 321
     $element->setComments($cm->get());
322 322
     $element->setCountCommentReport($cm->countCommentAlert());
323 323
     
324
-    $this->getDoctrine()->getEntityManager()->persist($element);
325
-    $this->getDoctrine()->getEntityManager()->flush();
324
+    $this->getDoctrine()->getManager()->persist($element);
325
+    $this->getDoctrine()->getManager()->flush();
326 326
     
327 327
     return $this->jsonResponse(array(
328 328
       'status' => 'success'
@@ -360,8 +360,8 @@ if (($non_condition = $this->userHaveNonConditionToMakeAction(SecurityContext::A
360 360
     $element->setComments($cm->get());
361 361
     $element->setCountCommentReport($cm->countCommentAlert());
362 362
     
363
-    $this->getDoctrine()->getEntityManager()->persist($element);
364
-    $this->getDoctrine()->getEntityManager()->flush();
363
+    $this->getDoctrine()->getManager()->persist($element);
364
+    $this->getDoctrine()->getManager()->flush();
365 365
     
366 366
     return $this->jsonResponse(array(
367 367
       'status' => 'success'

+ 8 - 8
src/Muzich/CoreBundle/Controller/CoreController.php View File

@@ -120,7 +120,7 @@ class CoreController extends Controller
120 120
     }
121 121
 
122 122
     // On tente de récupérer l'enregistrement FollowUser / FollowGroup
123
-    $em = $this->getDoctrine()->getEntityManager();
123
+    $em = $this->getDoctrine()->getManager();
124 124
     $Follow = $em
125 125
       ->getRepository('MuzichCoreBundle:Follow' . ucfirst($type))
126 126
       ->findOneBy(
@@ -204,7 +204,7 @@ class CoreController extends Controller
204 204
     }
205 205
     
206 206
     $user = $this->getUser(true, array('join' => array('groups_owned_groups_tags')));
207
-    $em = $this->getDoctrine()->getEntityManager();
207
+    $em = $this->getDoctrine()->getManager();
208 208
     
209 209
     /*
210 210
      * Contrôle préléminaire si groupe précisé
@@ -524,8 +524,8 @@ class CoreController extends Controller
524 524
       $fav->setTag($tag);
525 525
       $fav->setUser($user);
526 526
       $fav->setPosition(0);
527
-      $this->getDoctrine()->getEntityManager()->persist($fav);
528
-      $this->getDoctrine()->getEntityManager()->flush();
527
+      $this->getDoctrine()->getManager()->persist($fav);
528
+      $this->getDoctrine()->getManager()->flush();
529 529
     }
530 530
     
531 531
     return $this->jsonResponse(array(
@@ -573,8 +573,8 @@ class CoreController extends Controller
573 573
     
574 574
     // a partir d'ici on a tout ce qu'il faut
575 575
     $element->setGroup($group);
576
-    $this->getDoctrine()->getEntityManager()->persist($element);
577
-    $this->getDoctrine()->getEntityManager()->flush();
576
+    $this->getDoctrine()->getManager()->persist($element);
577
+    $this->getDoctrine()->getManager()->flush();
578 578
     
579 579
     // On récupère le nouveau dom de l'élément
580 580
     $html = $this->render('MuzichCoreBundle:SearchElement:element.html.twig', array(
@@ -616,8 +616,8 @@ class CoreController extends Controller
616 616
     $erm = new ElementReportManager($element);
617 617
     $erm->add($this->getUser());
618 618
     
619
-    $this->getDoctrine()->getEntityManager()->persist($element);
620
-    $this->getDoctrine()->getEntityManager()->flush();
619
+    $this->getDoctrine()->getManager()->persist($element);
620
+    $this->getDoctrine()->getManager()->flush();
621 621
     
622 622
     return $this->jsonResponse(array(
623 623
       'status' => 'success'

+ 22 - 22
src/Muzich/CoreBundle/Controller/ElementController.php View File

@@ -129,7 +129,7 @@ class ElementController extends Controller
129 129
     if ($form->isValid())
130 130
     {
131 131
       $status = 'success';
132
-      $em = $this->getDoctrine()->getEntityManager();
132
+      $em = $this->getDoctrine()->getManager();
133 133
       // On utilise le manager d'élément
134 134
       $factory = new ElementManager($element, $em, $this->container);
135 135
       $factory->proceedFill($user);
@@ -178,7 +178,7 @@ class ElementController extends Controller
178 178
     
179 179
     
180 180
     $element->setTagsWithIds(
181
-      $this->getDoctrine()->getEntityManager(), 
181
+      $this->getDoctrine()->getManager(), 
182 182
       json_decode($element->getTags())
183 183
     );
184 184
     
@@ -210,7 +210,7 @@ class ElementController extends Controller
210 210
     
211 211
     try {
212 212
       $element = $this->checkExistingAndOwned($element_id);
213
-      $em = $this->getDoctrine()->getEntityManager();
213
+      $em = $this->getDoctrine()->getManager();
214 214
       
215 215
       $event = new EventElement($this->container);
216 216
       $event->elementRemoved($element);
@@ -461,8 +461,8 @@ class ElementController extends Controller
461 461
     $event = new EventElement($this->container);
462 462
     $event->onePointAdded($element);
463 463
     
464
-    $this->getDoctrine()->getEntityManager()->persist($element);
465
-    $this->getDoctrine()->getEntityManager()->flush();
464
+    $this->getDoctrine()->getManager()->persist($element);
465
+    $this->getDoctrine()->getManager()->flush();
466 466
     
467 467
     return $this->jsonResponse(array(
468 468
       'status' => 'success',
@@ -520,8 +520,8 @@ class ElementController extends Controller
520 520
     $event = new EventElement($this->container);
521 521
     $event->onePointRemoved($element);
522 522
     
523
-    $this->getDoctrine()->getEntityManager()->persist($element);
524
-    $this->getDoctrine()->getEntityManager()->flush();
523
+    $this->getDoctrine()->getManager()->persist($element);
524
+    $this->getDoctrine()->getManager()->flush();
525 525
     
526 526
     return $this->jsonResponse(array(
527 527
       'status' => 'success',
@@ -625,7 +625,7 @@ class ElementController extends Controller
625 625
     if (count($tags_ids))
626 626
     {
627 627
       // On récupère les tags en base
628
-      $tags = $this->getDoctrine()->getEntityManager()->getRepository('MuzichCoreBundle:Tag')
628
+      $tags = $this->getDoctrine()->getManager()->getRepository('MuzichCoreBundle:Tag')
629 629
         ->getTagsWithIds($tags_ids)
630 630
       ;
631 631
     }
@@ -663,7 +663,7 @@ class ElementController extends Controller
663 663
           $private_ids = json_decode($tag->getPrivateids(), true);
664 664
           $private_ids[] = $element->getOwner()->getId();
665 665
           $tag->setPrivateids(json_encode($private_ids));
666
-          $this->getDoctrine()->getEntityManager()->persist($tag);
666
+          $this->getDoctrine()->getManager()->persist($tag);
667 667
         }
668 668
       }
669 669
           
@@ -672,14 +672,14 @@ class ElementController extends Controller
672 672
     
673 673
     $element->setHasTagProposition(true);
674 674
     
675
-    $this->getDoctrine()->getEntityManager()->persist($element);
676
-    $this->getDoctrine()->getEntityManager()->persist($proposition);
675
+    $this->getDoctrine()->getManager()->persist($element);
676
+    $this->getDoctrine()->getManager()->persist($proposition);
677 677
     
678 678
     // Notifs etc 
679 679
     $event = new EventElement($this->container);
680 680
     $event->tagsProposed($element);
681 681
     
682
-    $this->getDoctrine()->getEntityManager()->flush();
682
+    $this->getDoctrine()->getManager()->flush();
683 683
     
684 684
     return $this->jsonResponse(array(
685 685
       'status' => 'success',
@@ -712,7 +712,7 @@ class ElementController extends Controller
712 712
     }
713 713
     
714 714
     // On récupére toute les propsotions pour cet élément
715
-    $propositions = $this->getDoctrine()->getEntityManager()->getRepository('MuzichCoreBundle:ElementTagsProposition')
715
+    $propositions = $this->getDoctrine()->getManager()->getRepository('MuzichCoreBundle:ElementTagsProposition')
716 716
       ->findByElement($element->getId())
717 717
     ;
718 718
     
@@ -753,25 +753,25 @@ class ElementController extends Controller
753 753
     }
754 754
     $element->setHasTagProposition(false);
755 755
     $element->setNeedTags(false);
756
-    $this->getDoctrine()->getEntityManager()->persist($element);
756
+    $this->getDoctrine()->getManager()->persist($element);
757 757
     
758 758
     $event = new EventElement($this->container);
759 759
     $event->tagsAccepteds($proposition);
760 760
     
761
-    $propositions = $this->getDoctrine()->getEntityManager()->getRepository('MuzichCoreBundle:ElementTagsProposition')
761
+    $propositions = $this->getDoctrine()->getManager()->getRepository('MuzichCoreBundle:ElementTagsProposition')
762 762
       ->findByElement($element->getId())
763 763
     ;
764 764
     
765 765
     // On supprime les proposition liés a cet élement
766 766
     foreach ($propositions as $proposition)
767 767
     {
768
-      $this->getDoctrine()->getEntityManager()->remove($proposition);
768
+      $this->getDoctrine()->getManager()->remove($proposition);
769 769
     }
770 770
     
771 771
     // Traitement de l'Event si il y a
772 772
     $this->removeElementFromEvent($element->getId(), Event::TYPE_TAGS_PROPOSED);
773 773
     
774
-    $this->getDoctrine()->getEntityManager()->flush();
774
+    $this->getDoctrine()->getManager()->flush();
775 775
     $element = $this->getDoctrine()->getRepository('MuzichCoreBundle:Element')
776 776
       ->findOneById($element->getId())
777 777
     ;
@@ -804,12 +804,12 @@ class ElementController extends Controller
804 804
     }
805 805
     
806 806
     // On supprime les proposition liés a cet élement
807
-    $propositions = $this->getDoctrine()->getEntityManager()->getRepository('MuzichCoreBundle:ElementTagsProposition')
807
+    $propositions = $this->getDoctrine()->getManager()->getRepository('MuzichCoreBundle:ElementTagsProposition')
808 808
       ->findByElement($element->getId())
809 809
     ;
810 810
     foreach ($propositions as $proposition)
811 811
     {
812
-      $this->getDoctrine()->getEntityManager()->remove($proposition);
812
+      $this->getDoctrine()->getManager()->remove($proposition);
813 813
     }
814 814
     
815 815
     // Traitement de l'Event si il y a
@@ -817,8 +817,8 @@ class ElementController extends Controller
817 817
     
818 818
     // On spécifie qu'il n'y as plus de proposition
819 819
     $element->setHasTagProposition(false);
820
-    $this->getDoctrine()->getEntityManager()->persist($element);
821
-    $this->getDoctrine()->getEntityManager()->flush();
820
+    $this->getDoctrine()->getManager()->persist($element);
821
+    $this->getDoctrine()->getManager()->flush();
822 822
     
823 823
     return $this->jsonResponse(array(
824 824
       'status' => 'success'
@@ -903,7 +903,7 @@ class ElementController extends Controller
903 903
   
904 904
   protected function findTagsWithProposeds($tags)
905 905
   {
906
-    $tag_like = new TagLike($this->getDoctrine()->getEntityManager());
906
+    $tag_like = new TagLike($this->getDoctrine()->getManager());
907 907
     $tags_with_likes = array();
908 908
     foreach ($tags as $tag_name)
909 909
     {

+ 2 - 2
src/Muzich/CoreBundle/Controller/SearchController.php View File

@@ -253,7 +253,7 @@ class SearchController extends Controller
253 253
       if (strlen(trim($string_search)) > 1)
254 254
       {
255 255
         // On utilise l'objet TagLike
256
-        $TagLike = new TagLike($this->getDoctrine()->getEntityManager());
256
+        $TagLike = new TagLike($this->getDoctrine()->getManager());
257 257
         // Pour trier nos tags d'une manière plus humaine
258 258
         $sort_response = $TagLike->getSimilarTags($string_search, $this->getUserId(true));
259 259
       
@@ -302,7 +302,7 @@ class SearchController extends Controller
302 302
   {
303 303
     if ($this->getRequest()->isXmlHttpRequest())
304 304
     {
305
-      $tag_id = $this->getDoctrine()->getEntityManager()->createQuery("
305
+      $tag_id = $this->getDoctrine()->getManager()->createQuery("
306 306
         SELECT t.id FROM MuzichCoreBundle:Tag t
307 307
         WHERE t.name = :str
308 308
         ORDER BY t.name ASC"

+ 20 - 20
src/Muzich/CoreBundle/Tests/Controller/ElementControllerTest.php View File

@@ -507,14 +507,14 @@ class ElementControllerTest extends FunctionalTest
507 507
     ;
508 508
     
509 509
     // Pas de proposition en base pur cet élément
510
-    $propositions = $this->getDoctrine()->getEntityManager()->getRepository('MuzichCoreBundle:ElementTagsProposition')
510
+    $propositions = $this->getDoctrine()->getManager()->getRepository('MuzichCoreBundle:ElementTagsProposition')
511 511
       ->findOneByElement($element->getId())
512 512
     ;
513 513
     
514 514
     $this->assertEquals(0, count($propositions));
515 515
     
516 516
     // Pas d'événement pour bux
517
-    $events = $this->getDoctrine()->getEntityManager()
517
+    $events = $this->getDoctrine()->getManager()
518 518
       ->createQuery('SELECT e FROM MuzichCoreBundle:Event e
519 519
         WHERE e.user = :uid AND e.type = :type'
520 520
       )
@@ -565,7 +565,7 @@ class ElementControllerTest extends FunctionalTest
565 565
     $this->assertEquals($response['status'], 'success');
566 566
     
567 567
     // On a maintenant la proposition en base
568
-    $propositions = $this->getDoctrine()->getEntityManager()
568
+    $propositions = $this->getDoctrine()->getManager()
569 569
       ->createQuery('SELECT p, t FROM MuzichCoreBundle:ElementTagsProposition p'
570 570
         .' JOIN p.tags t WHERE p.element = :eid AND p.user = :uid')
571 571
       ->setParameters(array(
@@ -592,7 +592,7 @@ class ElementControllerTest extends FunctionalTest
592 592
     }
593 593
     
594 594
     // Il y a maintenant un event pour bux
595
-    $events = $this->getDoctrine()->getEntityManager()
595
+    $events = $this->getDoctrine()->getManager()
596 596
       ->createQuery('SELECT e FROM MuzichCoreBundle:Event e
597 597
         WHERE e.user = :uid AND e.type = :type'
598 598
       )
@@ -657,7 +657,7 @@ class ElementControllerTest extends FunctionalTest
657 657
     $this->assertEquals($response['status'], 'success');
658 658
     
659 659
     // On a maintenant la proposition en base
660
-    $propositions = $this->getDoctrine()->getEntityManager()
660
+    $propositions = $this->getDoctrine()->getManager()
661 661
       ->createQuery('SELECT p, t FROM MuzichCoreBundle:ElementTagsProposition p'
662 662
         .' JOIN p.tags t WHERE p.element = :eid AND p.user = :uid')
663 663
       ->setParameters(array(
@@ -684,7 +684,7 @@ class ElementControllerTest extends FunctionalTest
684 684
     }
685 685
     
686 686
     // avec la propsoition de joelle le nombre d'event n'a pas bougé (le compteur compte les éléments)
687
-    $events = $this->getDoctrine()->getEntityManager()
687
+    $events = $this->getDoctrine()->getManager()
688 688
       ->createQuery('SELECT e FROM MuzichCoreBundle:Event e
689 689
         WHERE e.user = :uid AND e.type = :type'
690 690
       )
@@ -785,7 +785,7 @@ class ElementControllerTest extends FunctionalTest
785 785
     }
786 786
         
787 787
     // La proposition de joelle a disparu
788
-    $propositions = $this->getDoctrine()->getEntityManager()
788
+    $propositions = $this->getDoctrine()->getManager()
789 789
       ->createQuery('SELECT p, t FROM MuzichCoreBundle:ElementTagsProposition p'
790 790
         .' JOIN p.tags t WHERE p.element = :eid AND p.user = :uid')
791 791
       ->setParameters(array(
@@ -797,7 +797,7 @@ class ElementControllerTest extends FunctionalTest
797 797
     $this->assertEquals(0, count($propositions));
798 798
     
799 799
     // celle de paul aussi 
800
-    $propositions = $this->getDoctrine()->getEntityManager()
800
+    $propositions = $this->getDoctrine()->getManager()
801 801
       ->createQuery('SELECT p, t FROM MuzichCoreBundle:ElementTagsProposition p'
802 802
         .' JOIN p.tags t WHERE p.element = :eid AND p.user = :uid')
803 803
       ->setParameters(array(
@@ -809,7 +809,7 @@ class ElementControllerTest extends FunctionalTest
809 809
     $this->assertEquals(0, count($propositions));
810 810
     
811 811
     // Mais on a un event en archive pour joelle
812
-    $archives = $this->getDoctrine()->getEntityManager()
812
+    $archives = $this->getDoctrine()->getManager()
813 813
       ->createQuery('SELECT a FROM MuzichCoreBundle:EventArchive a'
814 814
         .' WHERE a.user = :uid AND a.type = :type')
815 815
       ->setParameters(array(
@@ -822,7 +822,7 @@ class ElementControllerTest extends FunctionalTest
822 822
     $this->assertEquals(1, $archives[0]->getCount());
823 823
     
824 824
     // paul lui n'a pas d'archives
825
-    $archives = $this->getDoctrine()->getEntityManager()
825
+    $archives = $this->getDoctrine()->getManager()
826 826
       ->createQuery('SELECT a FROM MuzichCoreBundle:EventArchive a'
827 827
         .' WHERE a.user = :uid AND a.type = :type')
828 828
       ->setParameters(array(
@@ -877,14 +877,14 @@ class ElementControllerTest extends FunctionalTest
877 877
     ;
878 878
     
879 879
     // Pas de proposition en base pur cet élément
880
-    $propositions = $this->getDoctrine()->getEntityManager()->getRepository('MuzichCoreBundle:ElementTagsProposition')
880
+    $propositions = $this->getDoctrine()->getManager()->getRepository('MuzichCoreBundle:ElementTagsProposition')
881 881
       ->findOneByElement($element->getId())
882 882
     ;
883 883
     
884 884
     $this->assertEquals(0, count($propositions));
885 885
     
886 886
     // Pas d'événement pour bux
887
-    $events = $this->getDoctrine()->getEntityManager()
887
+    $events = $this->getDoctrine()->getManager()
888 888
       ->createQuery('SELECT e FROM MuzichCoreBundle:Event e
889 889
         WHERE e.user = :uid AND e.type = :type'
890 890
       )
@@ -935,7 +935,7 @@ class ElementControllerTest extends FunctionalTest
935 935
     $this->assertEquals($response['status'], 'success');
936 936
     
937 937
     // On a maintenant la proposition en base
938
-    $propositions = $this->getDoctrine()->getEntityManager()
938
+    $propositions = $this->getDoctrine()->getManager()
939 939
       ->createQuery('SELECT p, t FROM MuzichCoreBundle:ElementTagsProposition p'
940 940
         .' JOIN p.tags t WHERE p.element = :eid AND p.user = :uid')
941 941
       ->setParameters(array(
@@ -962,7 +962,7 @@ class ElementControllerTest extends FunctionalTest
962 962
     }
963 963
     
964 964
     // Il y a maintenant un event pour bux
965
-    $events = $this->getDoctrine()->getEntityManager()
965
+    $events = $this->getDoctrine()->getManager()
966 966
       ->createQuery('SELECT e FROM MuzichCoreBundle:Event e
967 967
         WHERE e.user = :uid AND e.type = :type'
968 968
       )
@@ -1027,7 +1027,7 @@ class ElementControllerTest extends FunctionalTest
1027 1027
     $this->assertEquals($response['status'], 'success');
1028 1028
     
1029 1029
     // On a maintenant la proposition en base
1030
-    $propositions = $this->getDoctrine()->getEntityManager()
1030
+    $propositions = $this->getDoctrine()->getManager()
1031 1031
       ->createQuery('SELECT p, t FROM MuzichCoreBundle:ElementTagsProposition p'
1032 1032
         .' JOIN p.tags t WHERE p.element = :eid AND p.user = :uid')
1033 1033
       ->setParameters(array(
@@ -1054,7 +1054,7 @@ class ElementControllerTest extends FunctionalTest
1054 1054
     }
1055 1055
     
1056 1056
     // avec la propsoition de joelle le nombre d'event n'a pas bougé (le compteur compte les éléments)
1057
-    $events = $this->getDoctrine()->getEntityManager()
1057
+    $events = $this->getDoctrine()->getManager()
1058 1058
       ->createQuery('SELECT e FROM MuzichCoreBundle:Event e
1059 1059
         WHERE e.user = :uid AND e.type = :type'
1060 1060
       )
@@ -1136,7 +1136,7 @@ class ElementControllerTest extends FunctionalTest
1136 1136
     );
1137 1137
     
1138 1138
     // La proposition de joelle a disparu
1139
-    $propositions = $this->getDoctrine()->getEntityManager()
1139
+    $propositions = $this->getDoctrine()->getManager()
1140 1140
       ->createQuery('SELECT p, t FROM MuzichCoreBundle:ElementTagsProposition p'
1141 1141
         .' JOIN p.tags t WHERE p.element = :eid AND p.user = :uid')
1142 1142
       ->setParameters(array(
@@ -1148,7 +1148,7 @@ class ElementControllerTest extends FunctionalTest
1148 1148
     $this->assertEquals(0, count($propositions));
1149 1149
     
1150 1150
     // celle de paul aussi 
1151
-    $propositions = $this->getDoctrine()->getEntityManager()
1151
+    $propositions = $this->getDoctrine()->getManager()
1152 1152
       ->createQuery('SELECT p, t FROM MuzichCoreBundle:ElementTagsProposition p'
1153 1153
         .' JOIN p.tags t WHERE p.element = :eid AND p.user = :uid')
1154 1154
       ->setParameters(array(
@@ -1160,7 +1160,7 @@ class ElementControllerTest extends FunctionalTest
1160 1160
     $this->assertEquals(0, count($propositions));
1161 1161
     
1162 1162
     // Et on as pas d'archive pour joelle
1163
-    $archives = $this->getDoctrine()->getEntityManager()
1163
+    $archives = $this->getDoctrine()->getManager()
1164 1164
       ->createQuery('SELECT a FROM MuzichCoreBundle:EventArchive a'
1165 1165
         .' WHERE a.user = :uid AND a.type = :type')
1166 1166
       ->setParameters(array(
@@ -1172,7 +1172,7 @@ class ElementControllerTest extends FunctionalTest
1172 1172
     $this->assertEquals(0, count($archives));
1173 1173
     
1174 1174
     // paul lui n'a pas d'archives non plus
1175
-    $archives = $this->getDoctrine()->getEntityManager()
1175
+    $archives = $this->getDoctrine()->getManager()
1176 1176
       ->createQuery('SELECT a FROM MuzichCoreBundle:EventArchive a'
1177 1177
         .' WHERE a.user = :uid AND a.type = :type')
1178 1178
       ->setParameters(array(

+ 28 - 28
src/Muzich/CoreBundle/Tests/Controller/EventTest.php View File

@@ -22,7 +22,7 @@ class EventTest extends FunctionalTest
22 22
     $bux = $this->getUser('bux');
23 23
     
24 24
     // Actuellement il n'y a aucun event d'ouvert pour bux (fixtures)
25
-    $result = $this->getDoctrine()->getEntityManager()
25
+    $result = $this->getDoctrine()->getManager()
26 26
       ->createQuery('SELECT e FROM MuzichCoreBundle:Event e
27 27
         WHERE e.user = :uid'
28 28
       )
@@ -55,7 +55,7 @@ class EventTest extends FunctionalTest
55 55
     $this->assertEquals($response['status'], 'success');
56 56
     
57 57
     // bux a maintenant un event en base
58
-    $result = $this->getDoctrine()->getEntityManager()
58
+    $result = $this->getDoctrine()->getManager()
59 59
       ->createQuery('
60 60
         SELECT e FROM MuzichCoreBundle:Event e
61 61
         WHERE e.user = :uid'
@@ -92,7 +92,7 @@ class EventTest extends FunctionalTest
92 92
     $this->assertEquals($response['status'], 'success');
93 93
     
94 94
     // bux a toujours 1 seul event en base
95
-    $result = $this->getDoctrine()->getEntityManager()
95
+    $result = $this->getDoctrine()->getManager()
96 96
       ->createQuery('
97 97
         SELECT e FROM MuzichCoreBundle:Event e
98 98
         WHERE e.user = :uid'
@@ -127,7 +127,7 @@ class EventTest extends FunctionalTest
127 127
     $this->assertEquals($response['status'], 'success');
128 128
     
129 129
     // bux a toujours 1 seul event en base
130
-    $result = $this->getDoctrine()->getEntityManager()
130
+    $result = $this->getDoctrine()->getManager()
131 131
       ->createQuery('SELECT e FROM MuzichCoreBundle:Event e
132 132
         WHERE e.user = :uid'
133 133
       )
@@ -171,7 +171,7 @@ class EventTest extends FunctionalTest
171 171
     $this->exist('a[href="'.$url.'"]');
172 172
     
173 173
     // L'objet Event est encore en base
174
-    $result = $this->getDoctrine()->getEntityManager()
174
+    $result = $this->getDoctrine()->getManager()
175 175
       ->createQuery('SELECT e FROM MuzichCoreBundle:Event e
176 176
         WHERE e.user = :uid'
177 177
       )
@@ -187,7 +187,7 @@ class EventTest extends FunctionalTest
187 187
     $this->isResponseSuccess();
188 188
     
189 189
     // L'objet Event ne doit plus être en base maintenant qu'il a été vu
190
-    $result = $this->getDoctrine()->getEntityManager()
190
+    $result = $this->getDoctrine()->getManager()
191 191
       ->createQuery('SELECT e FROM MuzichCoreBundle:Event e
192 192
         WHERE e.user = :uid'
193 193
       )
@@ -230,7 +230,7 @@ class EventTest extends FunctionalTest
230 230
     $bux = $this->getUser('bux');
231 231
     
232 232
     // Actuellement il n'y a aucun event d'ouvert pour bux (fixtures)
233
-    $result = $this->getDoctrine()->getEntityManager()
233
+    $result = $this->getDoctrine()->getManager()
234 234
       ->createQuery('SELECT e FROM MuzichCoreBundle:Event e
235 235
         WHERE e.user = :uid'
236 236
       )
@@ -266,7 +266,7 @@ class EventTest extends FunctionalTest
266 266
     $this->assertTrue(!is_null($fav));
267 267
     
268 268
     // bux a maintenant un event en base
269
-    $result = $this->getDoctrine()->getEntityManager()
269
+    $result = $this->getDoctrine()->getManager()
270 270
       ->createQuery('
271 271
         SELECT e FROM MuzichCoreBundle:Event e
272 272
         WHERE e.user = :uid'
@@ -299,7 +299,7 @@ class EventTest extends FunctionalTest
299 299
     $this->assertTrue(is_null($fav));
300 300
     
301 301
     // bux a toujours qu'un event avec un seul element signalé.
302
-    $result = $this->getDoctrine()->getEntityManager()
302
+    $result = $this->getDoctrine()->getManager()
303 303
       ->createQuery('
304 304
         SELECT e FROM MuzichCoreBundle:Event e
305 305
         WHERE e.user = :uid'
@@ -331,7 +331,7 @@ class EventTest extends FunctionalTest
331 331
     $paul = $this->getUser();
332 332
     
333 333
     // Actuellement il n'y a aucun event d'ouvert pour paul (fixtures)
334
-    $result = $this->getDoctrine()->getEntityManager()
334
+    $result = $this->getDoctrine()->getManager()
335 335
       ->createQuery('SELECT e FROM MuzichCoreBundle:Event e
336 336
         WHERE e.user = :uid'
337 337
       )
@@ -380,7 +380,7 @@ class EventTest extends FunctionalTest
380 380
     $joelle = $this->getUser();
381 381
     
382 382
     // Actuellement il n'y a aucun event d'ouvert pour joelle (fixtures)
383
-    $result = $this->getDoctrine()->getEntityManager()
383
+    $result = $this->getDoctrine()->getManager()
384 384
       ->createQuery('SELECT e FROM MuzichCoreBundle:Event e
385 385
         WHERE e.user = :uid'
386 386
       )
@@ -429,7 +429,7 @@ class EventTest extends FunctionalTest
429 429
     $bux = $this->getUser();
430 430
     
431 431
     // Actuellement il n'y a aucun event d'ouvert pour bux (fixtures)
432
-    $result = $this->getDoctrine()->getEntityManager()
432
+    $result = $this->getDoctrine()->getManager()
433 433
       ->createQuery('SELECT e FROM MuzichCoreBundle:Event e
434 434
         WHERE e.user = :uid'
435 435
       )
@@ -462,7 +462,7 @@ class EventTest extends FunctionalTest
462 462
     $this->assertEquals($response['status'], 'success');
463 463
     
464 464
     // Paul et Joelle on maintenant des events
465
-    $result = $this->getDoctrine()->getEntityManager()
465
+    $result = $this->getDoctrine()->getManager()
466 466
       ->createQuery('SELECT e FROM MuzichCoreBundle:Event e
467 467
         WHERE e.user = :uid AND e.type = :type'
468 468
       )
@@ -478,7 +478,7 @@ class EventTest extends FunctionalTest
478 478
     $this->assertEquals($result[0]['count'], 1);
479 479
     $this->assertEquals($result[0]['ids'], json_encode(array((string)$element->getId())));
480 480
     
481
-    $result = $this->getDoctrine()->getEntityManager()
481
+    $result = $this->getDoctrine()->getManager()
482 482
       ->createQuery('SELECT e FROM MuzichCoreBundle:Event e
483 483
         WHERE e.user = :uid AND e.type = :type'
484 484
       )
@@ -514,7 +514,7 @@ class EventTest extends FunctionalTest
514 514
     $this->assertEquals($response['status'], 'success');
515 515
     
516 516
     // Pas de mouvement coté événements
517
-    $result_paul = $this->getDoctrine()->getEntityManager()
517
+    $result_paul = $this->getDoctrine()->getManager()
518 518
       ->createQuery('SELECT e FROM MuzichCoreBundle:Event e
519 519
         WHERE e.user = :uid AND e.type = :type'
520 520
       )
@@ -530,7 +530,7 @@ class EventTest extends FunctionalTest
530 530
     $this->assertEquals($result[0]['count'], 1);
531 531
     $this->assertEquals($result[0]['ids'], json_encode(array((string)$element->getId())));
532 532
     
533
-    $result_jo = $this->getDoctrine()->getEntityManager()
533
+    $result_jo = $this->getDoctrine()->getManager()
534 534
       ->createQuery('SELECT e FROM MuzichCoreBundle:Event e
535 535
         WHERE e.user = :uid AND e.type = :type'
536 536
       )
@@ -556,7 +556,7 @@ class EventTest extends FunctionalTest
556 556
     $this->isResponseSuccess();
557 557
     
558 558
     // L'objet Event doit encore être en bas etant que l'on a pas validé sa suppression
559
-    $result = $this->getDoctrine()->getEntityManager()
559
+    $result = $this->getDoctrine()->getManager()
560 560
       ->createQuery('SELECT e FROM MuzichCoreBundle:Event e
561 561
         WHERE e.user = :uid'
562 562
       )
@@ -575,7 +575,7 @@ class EventTest extends FunctionalTest
575 575
     $this->isResponseSuccess();
576 576
         
577 577
     // L'objet Event ne doit plus être en base maintenant qu'il a été vu
578
-    $result = $this->getDoctrine()->getEntityManager()
578
+    $result = $this->getDoctrine()->getManager()
579 579
       ->createQuery('SELECT e FROM MuzichCoreBundle:Event e
580 580
         WHERE e.user = :uid'
581 581
       )
@@ -634,7 +634,7 @@ class EventTest extends FunctionalTest
634 634
     $this->isResponseSuccess();
635 635
         
636 636
     // L'objet Event ne doit plus être en base maintenant qu'il a été vu
637
-    $result = $this->getDoctrine()->getEntityManager()
637
+    $result = $this->getDoctrine()->getManager()
638 638
       ->createQuery('SELECT e FROM MuzichCoreBundle:Event e
639 639
         WHERE e.user = :uid'
640 640
       )
@@ -672,7 +672,7 @@ class EventTest extends FunctionalTest
672 672
     $this->assertEquals($response['status'], 'success');
673 673
     
674 674
     // Paul et Joelle on maintenant des events
675
-    $result = $this->getDoctrine()->getEntityManager()
675
+    $result = $this->getDoctrine()->getManager()
676 676
       ->createQuery('SELECT e FROM MuzichCoreBundle:Event e
677 677
         WHERE e.user = :uid AND e.type = :type'
678 678
       )
@@ -684,7 +684,7 @@ class EventTest extends FunctionalTest
684 684
     ;
685 685
     $this->assertEquals(count($result), 0);
686 686
     
687
-    $result = $this->getDoctrine()->getEntityManager()
687
+    $result = $this->getDoctrine()->getManager()
688 688
       ->createQuery('SELECT e FROM MuzichCoreBundle:Event e
689 689
         WHERE e.user = :uid AND e.type = :type'
690 690
       )
@@ -710,7 +710,7 @@ class EventTest extends FunctionalTest
710 710
     $bob = $this->getUser('bob');
711 711
     
712 712
     // Actuellement il n'y a aucun event d'ouvert pour paul (fixtures)
713
-    $result = $this->getDoctrine()->getEntityManager()
713
+    $result = $this->getDoctrine()->getManager()
714 714
       ->createQuery('SELECT e FROM MuzichCoreBundle:Event e
715 715
         WHERE e.user = :uid'
716 716
       )
@@ -744,7 +744,7 @@ class EventTest extends FunctionalTest
744 744
     $this->isResponseSuccess();
745 745
     
746 746
     // Désormais bob doit avoir un event
747
-    $result = $this->getDoctrine()->getEntityManager()
747
+    $result = $this->getDoctrine()->getManager()
748 748
       ->createQuery('SELECT e FROM MuzichCoreBundle:Event e
749 749
         WHERE e.user = :uid AND e.type = :type'
750 750
       )
@@ -778,7 +778,7 @@ class EventTest extends FunctionalTest
778 778
     $this->exist('ul#followers_users li:contains(\'bux\')');
779 779
     
780 780
     // L'event n'existe d'ailleurs plus en base
781
-    $result = $this->getDoctrine()->getEntityManager()
781
+    $result = $this->getDoctrine()->getManager()
782 782
       ->createQuery('SELECT e FROM MuzichCoreBundle:Event e
783 783
         WHERE e.user = :uid'
784 784
       )
@@ -823,7 +823,7 @@ class EventTest extends FunctionalTest
823 823
   
824 824
   protected function eventCount($user, $type, $count)
825 825
   {
826
-    $events = $this->getDoctrine()->getEntityManager()
826
+    $events = $this->getDoctrine()->getManager()
827 827
       ->createQuery('SELECT e FROM MuzichCoreBundle:Event e
828 828
         WHERE e.user = :uid AND e.type = :type'
829 829
       )
@@ -860,7 +860,7 @@ class EventTest extends FunctionalTest
860 860
   
861 861
   protected function eventHasElementId($user, $type, $element_id)
862 862
   {
863
-    $events = $this->getDoctrine()->getEntityManager()
863
+    $events = $this->getDoctrine()->getManager()
864 864
       ->createQuery('SELECT e FROM MuzichCoreBundle:Event e
865 865
         WHERE e.user = :uid AND e.type = :type AND e.ids LIKE :eid'
866 866
       )
@@ -877,7 +877,7 @@ class EventTest extends FunctionalTest
877 877
   
878 878
   protected function eventHasNotElementId($user, $type, $element_id)
879 879
   {
880
-    $events = $this->getDoctrine()->getEntityManager()
880
+    $events = $this->getDoctrine()->getManager()
881 881
       ->createQuery('SELECT e FROM MuzichCoreBundle:Event e
882 882
         WHERE e.user = :uid AND e.type = :type AND e.ids LIKE :eid'
883 883
       )
@@ -935,7 +935,7 @@ class EventTest extends FunctionalTest
935 935
   
936 936
   protected function getElementTagProposition($element_id, $user_id)
937 937
   {
938
-    $propositions = $this->getDoctrine()->getEntityManager()
938
+    $propositions = $this->getDoctrine()->getManager()
939 939
       ->createQuery('SELECT p, t FROM MuzichCoreBundle:ElementTagsProposition p'
940 940
         .' JOIN p.tags t WHERE p.element = :eid AND p.user = :uid')
941 941
       ->setParameters(array(

+ 3 - 3
src/Muzich/CoreBundle/Tests/Controller/FavoriteControllerTest.php View File

@@ -22,7 +22,7 @@ class FavoriteControllerTest extends FunctionalTest
22 22
     $this->clickOnLink($link);
23 23
     $this->isResponseSuccess();
24 24
         
25
-    $elements = $this->getDoctrine()->getEntityManager()->createQuery("
25
+    $elements = $this->getDoctrine()->getManager()->createQuery("
26 26
       SELECT e FROM MuzichCoreBundle:Element e
27 27
       LEFT JOIN e.elements_favorites ef
28 28
       WHERE ef.user = :uid
@@ -56,7 +56,7 @@ class FavoriteControllerTest extends FunctionalTest
56 56
     // On se rend sur sa page des favoris de bux
57 57
     $this->crawler = $this->client->request('GET', $this->generateUrl('favorite_user_list', array('slug' => 'bux')));
58 58
            
59
-    $elements = $this->getDoctrine()->getEntityManager()->createQuery("
59
+    $elements = $this->getDoctrine()->getManager()->createQuery("
60 60
       SELECT e FROM MuzichCoreBundle:Element e
61 61
       LEFT JOIN e.elements_favorites ef
62 62
       WHERE ef.user = :uid
@@ -91,7 +91,7 @@ class FavoriteControllerTest extends FunctionalTest
91 91
     // On se rend sur sa page des favoris de bux
92 92
     $this->crawler = $this->client->request('GET', $this->generateUrl('favorite_user_list', array('slug' => 'bux')));
93 93
            
94
-    $elements = $this->getDoctrine()->getEntityManager()->createQuery("
94
+    $elements = $this->getDoctrine()->getManager()->createQuery("
95 95
       SELECT e FROM MuzichCoreBundle:Element e
96 96
       LEFT JOIN e.elements_favorites ef
97 97
       WHERE ef.user = :uid

+ 1 - 1
src/Muzich/CoreBundle/Tests/Controller/HomeControllerTest.php View File

@@ -945,7 +945,7 @@ class HomeControllerTest extends FunctionalTest
945 945
     $bux = $this->getUser();
946 946
     
947 947
     // On récupère la proposition
948
-    $propositions = $this->getDoctrine()->getEntityManager()
948
+    $propositions = $this->getDoctrine()->getManager()
949 949
       ->createQuery('SELECT p, t FROM MuzichCoreBundle:ElementTagsProposition p'
950 950
         .' JOIN p.tags t WHERE p.element = :eid AND p.user = :uid')
951 951
       ->setParameters(array(

+ 2 - 2
src/Muzich/CoreBundle/Tests/Controller/IndexControllerTest.php View File

@@ -80,7 +80,7 @@ class IndexControllerTest extends FunctionalTest
80 80
     // On a besoin d'un token pour le moment
81 81
     $token = new RegistrationToken();
82 82
     $token->setToken('4vcsdv54svqcc3q1v54sdv6qs');
83
-    $em = $this->getDoctrine()->getEntityManager();
83
+    $em = $this->getDoctrine()->getManager();
84 84
     $em->persist($token);
85 85
     $em->flush();
86 86
     
@@ -106,7 +106,7 @@ class IndexControllerTest extends FunctionalTest
106 106
     $token = new RegistrationToken();
107 107
     $token_name = '45gf645jgf6xqz4dc'.time();
108 108
     $token->setToken($token_name);
109
-    $em = $this->getDoctrine()->getEntityManager();
109
+    $em = $this->getDoctrine()->getManager();
110 110
     $em->persist($token);
111 111
     $em->flush();
112 112
     

+ 2 - 2
src/Muzich/CoreBundle/Tests/Controller/ReputationTest.php View File

@@ -30,8 +30,8 @@ class ReputationTest extends FunctionalTest
30 30
 //    
31 31
 //    $bux = $this->getUser('bux');
32 32
 //    $bux->setReputation(0);
33
-//    $this->getDoctrine()->getEntityManager()->persist($bux);
34
-//    $this->getDoctrine()->getEntityManager()->flush();
33
+//    $this->getDoctrine()->getManager()->persist($bux);
34
+//    $this->getDoctrine()->getManager()->flush();
35 35
 //    
36 36
 //    $bux = $this->getUser('bux');
37 37
 //    $this->assertEquals($bux->getReputation(), 0);

+ 2 - 2
src/Muzich/CoreBundle/Tests/Controller/ShowControllerTest.php View File

@@ -199,8 +199,8 @@ class ShowControllerTest extends FunctionalTest
199 199
         'followed' => $paul->getId()
200 200
       ))
201 201
     ;
202
-    $this->getDoctrine()->getEntityManager()->remove($follow);
203
-    $this->getDoctrine()->getEntityManager()->flush();
202
+    $this->getDoctrine()->getManager()->remove($follow);
203
+    $this->getDoctrine()->getManager()->flush();
204 204
     
205 205
     // On rafraichie la page
206 206
     $this->crawler = $this->client->request('GET', 

+ 1 - 1
src/Muzich/CoreBundle/Tests/Controller/UserControllerTest.php View File

@@ -307,7 +307,7 @@ class UserControllerTest extends FunctionalTest
307 307
       - $this->getContainer()->getParameter('changeemail_security_delay')
308 308
     );
309 309
     
310
-    $this->getDoctrine()->getEntityManager()->flush();
310
+    $this->getDoctrine()->getManager()->flush();
311 311
     
312 312
     $form = $this->selectForm('form[action="'.$url.'"] input[type="submit"]');
313 313
     $form['form[email]'] = 'trololololooo222@trolo.com';

+ 8 - 8
src/Muzich/CoreBundle/Tests/Tag/TagReadTest.php View File

@@ -49,7 +49,7 @@ class TagReadTest extends UnitTest
49 49
         'Punk rock', 'Ska-punk', 'Skate punk', 'Synthpunk' 
50 50
     );
51 51
     
52
-    $TagLike = new TagLike($this->getDoctrine()->getEntityManager());
52
+    $TagLike = new TagLike($this->getDoctrine()->getManager());
53 53
     $response = $TagLike->getSimilarTags('punk', $bux->getId());
54 54
     
55 55
     $this->assertEquals(count($cresults), count($response['tags']));
@@ -72,7 +72,7 @@ class TagReadTest extends UnitTest
72 72
       'Reggae'
73 73
     );
74 74
     
75
-    $TagLike = new TagLike($this->getDoctrine()->getEntityManager());
75
+    $TagLike = new TagLike($this->getDoctrine()->getManager());
76 76
     $response = $TagLike->getSimilarTags('reggea', $bux->getId());
77 77
     
78 78
     $this->assertEquals(count($cresults), count($response['tags']));
@@ -96,7 +96,7 @@ class TagReadTest extends UnitTest
96 96
         'Punk rock', 'Ska-punk', 'Skate punk', 'Synthpunk' 
97 97
     );
98 98
     
99
-    $TagLike = new TagLike($this->getDoctrine()->getEntityManager());
99
+    $TagLike = new TagLike($this->getDoctrine()->getManager());
100 100
     $tags = $this->getTagsNames($result = $TagLike->getSimilarTags('punk', $bux->getId()));
101 101
     
102 102
     $this->assertEquals($cresults, $tags);
@@ -108,7 +108,7 @@ class TagReadTest extends UnitTest
108 108
         'Punk rock', 'Ska-punk', 'Skate punk', 'Synthpunk' 
109 109
     );
110 110
     
111
-    $TagLike = new TagLike($this->getDoctrine()->getEntityManager());
111
+    $TagLike = new TagLike($this->getDoctrine()->getManager());
112 112
     $tags = $this->getTagsNames($result = $TagLike->getSimilarTags('anarcho punk', $bux->getId()));
113 113
     
114 114
     $this->assertEquals($cresults, $tags);
@@ -120,7 +120,7 @@ class TagReadTest extends UnitTest
120 120
         'Punk rock', 'Ska-punk', 'Skate punk', 'Synthpunk' 
121 121
     );
122 122
     
123
-    $TagLike = new TagLike($this->getDoctrine()->getEntityManager());
123
+    $TagLike = new TagLike($this->getDoctrine()->getManager());
124 124
     $tags = $this->getTagsNames($result = $TagLike->getSimilarTags('punk anarcho', $bux->getId()));
125 125
     
126 126
     $this->assertEquals($cresults, $tags);
@@ -132,7 +132,7 @@ class TagReadTest extends UnitTest
132 132
         'Punk rock', 'Ska-punk', 'Skate punk', 'Synthpunk' 
133 133
     );
134 134
     
135
-    $TagLike = new TagLike($this->getDoctrine()->getEntityManager());
135
+    $TagLike = new TagLike($this->getDoctrine()->getManager());
136 136
     $tags = $this->getTagsNames($result = $TagLike->getSimilarTags('punk anar', $bux->getId()));
137 137
     
138 138
     $this->assertEquals($cresults, $tags);
@@ -144,7 +144,7 @@ class TagReadTest extends UnitTest
144 144
         'Pop-punk', 'Post-Punk', 'Punk rock', 'Ska-jazz', 'Skacore',  'Synthpunk' 
145 145
     );
146 146
     
147
-    $TagLike = new TagLike($this->getDoctrine()->getEntityManager());
147
+    $TagLike = new TagLike($this->getDoctrine()->getManager());
148 148
     $tags = $this->getTagsNames($result = $TagLike->getSimilarTags('ska punk', $bux->getId()));
149 149
     
150 150
     $this->assertEquals($cresults, $tags);
@@ -155,7 +155,7 @@ class TagReadTest extends UnitTest
155 155
       'Horror punk'
156 156
     );
157 157
     
158
-    $TagLike = new TagLike($this->getDoctrine()->getEntityManager());
158
+    $TagLike = new TagLike($this->getDoctrine()->getManager());
159 159
     $tags = $this->getTagsNames($result = $TagLike->getSimilarTags('horror', $bux->getId()));
160 160
     
161 161
     $this->assertEquals($cresults, $tags);

+ 12 - 12
src/Muzich/CoreBundle/Tests/Tag/TagWriteTest.php View File

@@ -162,14 +162,14 @@ class TagWriteTest extends UnitTest
162 162
       ->findOneByName('Ed Cox - La fanfare des teuffeurs (Hardcordian)')
163 163
     ;
164 164
     $element->addTag($tag_3);
165
-    $this->getDoctrine()->getEntityManager()->persist($element);
165
+    $this->getDoctrine()->getManager()->persist($element);
166 166
     
167 167
     // Ajout en tag favoris
168 168
     $new_fav = new UsersTagsFavorites();
169 169
     $new_fav->setTag($tag_3);
170 170
     $new_fav->setUser($bux);
171 171
     $new_fav->setPosition(0);
172
-    $this->getDoctrine()->getEntityManager()->persist($new_fav);
172
+    $this->getDoctrine()->getManager()->persist($new_fav);
173 173
     
174 174
     // Ajout en tag de groupe
175 175
     $group = $this->getDoctrine()->getRepository('MuzichCoreBundle:Group')
@@ -180,9 +180,9 @@ class TagWriteTest extends UnitTest
180 180
     $new_fav->setTag($tag_3);
181 181
     $new_fav->setGroup($group);
182 182
     $new_fav->setPosition(0);
183
-    $this->getDoctrine()->getEntityManager()->persist($new_fav);
183
+    $this->getDoctrine()->getManager()->persist($new_fav);
184 184
     
185
-    $this->getDoctrine()->getEntityManager()->flush();
185
+    $this->getDoctrine()->getManager()->flush();
186 186
     
187 187
     // On check que ces netités soit en base
188 188
     // Et que celle qui vont suivre (après le remplacement) n'y soit pas
@@ -244,8 +244,8 @@ class TagWriteTest extends UnitTest
244 244
     ;
245 245
     $this->assertTrue(is_null($fav));
246 246
     
247
-    $this->getDoctrine()->getEntityManager()->persist($tag_1);
248
-    $this->getDoctrine()->getEntityManager()->persist($tag_3);
247
+    $this->getDoctrine()->getManager()->persist($tag_1);
248
+    $this->getDoctrine()->getManager()->persist($tag_3);
249 249
     
250 250
     // A ce stade les vérifications on été faites on lance le replace
251 251
     // Test 3: On remplace
@@ -312,7 +312,7 @@ class TagWriteTest extends UnitTest
312 312
     ;
313 313
     $this->assertTrue(!is_null($fav));
314 314
     
315
-    $this->getDoctrine()->getEntityManager()->persist($tag_3);
315
+    $this->getDoctrine()->getManager()->persist($tag_3);
316 316
     $this->clean();
317 317
   }
318 318
   
@@ -327,11 +327,11 @@ class TagWriteTest extends UnitTest
327 327
     $tag4 = $this->getDoctrine()->getRepository('MuzichCoreBundle:Tag')
328 328
       ->findOneByName('Xvlsd aoj 12');
329 329
     
330
-    ($tag1) ? $this->getDoctrine()->getEntityManager()->remove($tag1) : '';
331
-    ($tag2) ? $this->getDoctrine()->getEntityManager()->remove($tag2) : '';
332
-    ($tag3) ? $this->getDoctrine()->getEntityManager()->remove($tag3) : '';
333
-    ($tag4) ? $this->getDoctrine()->getEntityManager()->remove($tag4) : '';
334
-    $this->getDoctrine()->getEntityManager()->flush();
330
+    ($tag1) ? $this->getDoctrine()->getManager()->remove($tag1) : '';
331
+    ($tag2) ? $this->getDoctrine()->getManager()->remove($tag2) : '';
332
+    ($tag3) ? $this->getDoctrine()->getManager()->remove($tag3) : '';
333
+    ($tag4) ? $this->getDoctrine()->getManager()->remove($tag4) : '';
334
+    $this->getDoctrine()->getManager()->flush();
335 335
   }
336 336
   
337 337
 }

+ 1 - 1
src/Muzich/CoreBundle/Tests/User/UserTest.php View File

@@ -109,7 +109,7 @@ class UserTest extends UnitTest
109 109
       ), $bux->getTagsFavoritesQuick());
110 110
     }
111 111
     
112
-    $this->getDoctrine()->getEntityManager()->remove($bux_melodique);
112
+    $this->getDoctrine()->getManager()->remove($bux_melodique);
113 113
     $this->flush();
114 114
     
115 115
     $bux = $this->getUser('bux');

+ 1 - 1
src/Muzich/CoreBundle/lib/Controller.php View File

@@ -517,7 +517,7 @@ class Controller extends BaseController
517 517
    */
518 518
   public function getEntityManager()
519 519
   {
520
-    return $this->getDoctrine()->getEntityManager();
520
+    return $this->getDoctrine()->getManager();
521 521
   }
522 522
   
523 523
   /**

+ 2 - 2
src/Muzich/CoreBundle/lib/FunctionalTest.php View File

@@ -271,7 +271,7 @@ class FunctionalTest extends WebTestCase
271 271
    */
272 272
   protected function findUserByUsername($username)
273 273
   {
274
-    return $this->getDoctrine()->getEntityManager()->getRepository('MuzichCoreBundle:User')
274
+    return $this->getDoctrine()->getManager()->getRepository('MuzichCoreBundle:User')
275 275
       ->findOneByUsername($username)
276 276
     ;
277 277
   }
@@ -530,7 +530,7 @@ class FunctionalTest extends WebTestCase
530 530
    */
531 531
   protected function getEntityManager()
532 532
   {
533
-    return $this->getDoctrine()->getEntityManager();
533
+    return $this->getDoctrine()->getManager();
534 534
   }
535 535
   
536 536
   /**

+ 5 - 5
src/Muzich/CoreBundle/lib/UnitTest.php View File

@@ -46,7 +46,7 @@ class UnitTest extends \PHPUnit_Framework_TestCase
46 46
     
47 47
     $factory = new ElementManager(
48 48
       $element, 
49
-      $this->getDoctrine()->getEntityManager(), 
49
+      $this->getDoctrine()->getManager(), 
50 50
       $this->_container
51 51
     );
52 52
     $factory->proceedFill($user);
@@ -71,7 +71,7 @@ class UnitTest extends \PHPUnit_Framework_TestCase
71 71
     $element->setUrl($url);
72 72
     
73 73
     $factory = new ElementManager($element, 
74
-      $this->getDoctrine()->getEntityManager(), $this->_container);
74
+      $this->getDoctrine()->getManager(), $this->_container);
75 75
     $factory->proceedFill($user);
76 76
     
77 77
     return $element->getDatas();
@@ -95,12 +95,12 @@ class UnitTest extends \PHPUnit_Framework_TestCase
95 95
   
96 96
   protected function persist($entity)
97 97
   {
98
-    $this->getDoctrine()->getEntityManager()->persist($entity);
98
+    $this->getDoctrine()->getManager()->persist($entity);
99 99
   }
100 100
   
101 101
   protected function flush()
102 102
   {
103
-    $this->getDoctrine()->getEntityManager()->flush();
103
+    $this->getDoctrine()->getManager()->flush();
104 104
   }
105 105
   
106 106
   /**
@@ -109,7 +109,7 @@ class UnitTest extends \PHPUnit_Framework_TestCase
109 109
    */
110 110
   protected function getEntityManager()
111 111
   {
112
-    return $this->getDoctrine()->getEntityManager();
112
+    return $this->getDoctrine()->getManager();
113 113
   }
114 114
   
115 115
   /**

+ 2 - 2
src/Muzich/FavoriteBundle/Controller/FavoriteController.php View File

@@ -102,7 +102,7 @@ class FavoriteController extends Controller
102 102
     }
103 103
     
104 104
     $user = $this->getUser();
105
-    $em = $this->getDoctrine()->getEntityManager();
105
+    $em = $this->getDoctrine()->getManager();
106 106
     
107 107
     if ($user->getPersonalHash($id) != $token || !is_numeric($id)
108 108
       || !($element = $em->getRepository('MuzichCoreBundle:Element')->findOneById($id))
@@ -271,7 +271,7 @@ class FavoriteController extends Controller
271 271
     $viewed_user = $this->getUser();
272 272
     if ($user_id != $this->getUserId(true))
273 273
     {
274
-      $viewed_user = $this->getDoctrine()->getEntityManager()->getRepository('MuzichCoreBundle:User')
274
+      $viewed_user = $this->getDoctrine()->getManager()->getRepository('MuzichCoreBundle:User')
275 275
         ->findOneById($user_id, array())->getSingleResult();
276 276
     }
277 277
     

+ 3 - 3
src/Muzich/GroupBundle/Controller/DefaultController.php View File

@@ -64,7 +64,7 @@ if (($non_condition = $this->userHaveNonConditionToMakeAction(SecurityContext::A
64 64
       throw $this->createNotFoundException();
65 65
     }
66 66
     
67
-    $em = $this->getDoctrine()->getEntityManager();
67
+    $em = $this->getDoctrine()->getManager();
68 68
     
69 69
     $new_group = new Group();
70 70
     $new_group->setOwner($user);
@@ -152,7 +152,7 @@ if (($non_condition = $this->userHaveNonConditionToMakeAction(SecurityContext::A
152 152
   
153 153
   public function updateAction(Request $request, $slug)
154 154
   {
155
-    $em = $this->getDoctrine()->getEntityManager();
155
+    $em = $this->getDoctrine()->getManager();
156 156
     $group = $this->findGroupWithSlug($slug);
157 157
     
158 158
     if ($group->getOwner()->getId() != $this->getUserId())
@@ -212,7 +212,7 @@ if (($non_condition = $this->userHaveNonConditionToMakeAction(SecurityContext::A
212 212
       throw $this->createNotFoundException('Accès non autorisé.');
213 213
     }
214 214
     
215
-    $em = $this->getDoctrine()->getEntityManager();
215
+    $em = $this->getDoctrine()->getManager();
216 216
     
217 217
     // Il faudra le faire avec doctrine:
218 218
     $elements = $this->getDoctrine()->getRepository('MuzichCoreBundle:Element')

+ 2 - 2
src/Muzich/HomeBundle/Controller/ShowController.php View File

@@ -158,12 +158,12 @@ class ShowController extends Controller
158 158
     }
159 159
     else if ($type == 'user')
160 160
     {
161
-      $object = $viewed_user = $this->getDoctrine()->getEntityManager()->getRepository('MuzichCoreBundle:User')
161
+      $object = $viewed_user = $this->getDoctrine()->getManager()->getRepository('MuzichCoreBundle:User')
162 162
         ->findOneById($object_id, array())->getSingleResult();
163 163
     }
164 164
     else if ($type == 'group')
165 165
     {
166
-      $object = $this->getDoctrine()->getEntityManager()->getRepository('MuzichCoreBundle:Group')
166
+      $object = $this->getDoctrine()->getManager()->getRepository('MuzichCoreBundle:Group')
167 167
         ->findOneById($object_id);
168 168
     }
169 169
     

+ 2 - 2
src/Muzich/MynetworkBundle/Controller/MynetworkController.php View File

@@ -51,8 +51,8 @@ class MynetworkController extends Controller
51 51
   {
52 52
     $ids = $event->getIds();
53 53
     
54
-    $this->getDoctrine()->getEntityManager()->remove($event);
55
-    $this->getDoctrine()->getEntityManager()->flush();
54
+    $this->getDoctrine()->getManager()->remove($event);
55
+    $this->getDoctrine()->getManager()->flush();
56 56
     
57 57
     $followers_users_new = array();
58 58
     foreach ($followers_users as $user)

+ 5 - 5
src/Muzich/UserBundle/Controller/UserController.php View File

@@ -317,7 +317,7 @@ class UserController extends Controller
317 317
       if ($form->isValid())
318 318
       {
319 319
         $data = $form->getData();
320
-        $user->updateTagsFavoritesById($this->getDoctrine()->getEntityManager(), $data['tags']);
320
+        $user->updateTagsFavoritesById($this->getDoctrine()->getManager(), $data['tags']);
321 321
         
322 322
         // On réinitialise l'eventuel session de recherche en mémoire
323 323
         $session = $this->get("session");
@@ -383,7 +383,7 @@ class UserController extends Controller
383 383
    */
384 384
   public function changeEmailRequestAction()
385 385
   {
386
-    $em = $this->getDoctrine()->getEntityManager();
386
+    $em = $this->getDoctrine()->getManager();
387 387
     $user = $this->getUser();
388 388
     
389 389
     $request = $this->getRequest();
@@ -470,7 +470,7 @@ class UserController extends Controller
470 470
    */
471 471
   public function changeEmailConfirmAction($token)
472 472
   {
473
-    $em = $this->getDoctrine()->getEntityManager();
473
+    $em = $this->getDoctrine()->getManager();
474 474
     $um = $this->get('muzich_user_manager');
475 475
     $user = $this->getUser();
476 476
     
@@ -533,8 +533,8 @@ class UserController extends Controller
533 533
     
534 534
     $user->setTown(trim($this->getRequest()->request->get('town')));
535 535
     $user->setCountry(trim($this->getRequest()->request->get('country')));
536
-    $this->getDoctrine()->getEntityManager()->persist($user);
537
-    $this->getDoctrine()->getEntityManager()->flush();
536
+    $this->getDoctrine()->getManager()->persist($user);
537
+    $this->getDoctrine()->getManager()->flush();
538 538
     
539 539
     return $this->jsonResponse(array(
540 540
       'status' => 'success'