Browse Source

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

Bastien Sevajol 11 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
     $element->setComments($cm->get());
30
     $element->setComments($cm->get());
31
     $element->setCountCommentReport($cm->countCommentAlert());
31
     $element->setCountCommentReport($cm->countCommentAlert());
32
     
32
     
33
-    $this->getDoctrine()->getEntityManager()->persist($element);
33
+    $this->getDoctrine()->getManager()->persist($element);
34
     
34
     
35
     // On récupère les user qui ont signalés ce commentaire
35
     // On récupère les user qui ont signalés ce commentaire
36
-    $users = $this->getDoctrine()->getEntityManager()
36
+    $users = $this->getDoctrine()->getManager()
37
       ->createQuery('
37
       ->createQuery('
38
         SELECT u FROM MuzichCoreBundle:User u
38
         SELECT u FROM MuzichCoreBundle:User u
39
         WHERE u.id IN (:uids)'
39
         WHERE u.id IN (:uids)'
46
     foreach ($users as $user)
46
     foreach ($users as $user)
47
     {
47
     {
48
       $user->addBadReport();
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
     if (!$this->getRequest()->isXmlHttpRequest())
54
     if (!$this->getRequest()->isXmlHttpRequest())
55
     {
55
     {
78
     
78
     
79
     // On récupère l'auteur du commentaire pour lui incrémenté son compteur
79
     // On récupère l'auteur du commentaire pour lui incrémenté son compteur
80
     // de contenu modéré
80
     // de contenu modéré
81
-    $user = $this->getDoctrine()->getEntityManager()->getRepository('MuzichCoreBundle:User')
81
+    $user = $this->getDoctrine()->getManager()->getRepository('MuzichCoreBundle:User')
82
       ->findOneBy(array(
82
       ->findOneBy(array(
83
         'id' => $comment['u']['i']
83
         'id' => $comment['u']['i']
84
       ));
84
       ));
85
     
85
     
86
     $user->addModeratedCommentCount();
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
     if (!$this->getRequest()->isXmlHttpRequest())
92
     if (!$this->getRequest()->isXmlHttpRequest())
93
     {
93
     {

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

26
     $user_ids = $element->getReportIds();
26
     $user_ids = $element->getReportIds();
27
     $element->setReportIds(null);
27
     $element->setReportIds(null);
28
     $element->setCountReport(null);
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
       ->createQuery('
32
       ->createQuery('
33
         SELECT u FROM MuzichCoreBundle:User u
33
         SELECT u FROM MuzichCoreBundle:User u
34
         WHERE u.id IN (:uids)'
34
         WHERE u.id IN (:uids)'
40
     foreach ($users as $user)
40
     foreach ($users as $user)
41
     {
41
     {
42
       $user->addBadReport();
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
     $this->get('session')->setFlash('success', $this->get('translator')->trans("object.edit.success", array(), 'Admingenerator') );
48
     $this->get('session')->setFlash('success', $this->get('translator')->trans("object.edit.success", array(), 'Admingenerator') );
49
     return new RedirectResponse($this->generateUrl("Muzich_AdminBundle_Moderate_element_list" ));
49
     return new RedirectResponse($this->generateUrl("Muzich_AdminBundle_Moderate_element_list" ));
56
     $event->elementRemoved($element);
56
     $event->elementRemoved($element);
57
     $element->getOwner()->addModeratedElementCount();
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
     $this->get('session')->setFlash('success', $this->get('translator')->trans("object.edit.success", array(), 'Admingenerator') );
63
     $this->get('session')->setFlash('success', $this->get('translator')->trans("object.edit.success", array(), 'Admingenerator') );
64
     return new RedirectResponse($this->generateUrl("Muzich_AdminBundle_Moderate_element_list" ));
64
     return new RedirectResponse($this->generateUrl("Muzich_AdminBundle_Moderate_element_list" ));

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

53
     
53
     
54
     $uids = json_decode($tag->getPrivateids(), true);
54
     $uids = json_decode($tag->getPrivateids(), true);
55
     
55
     
56
-    $users = $this->getDoctrine()->getEntityManager()
56
+    $users = $this->getDoctrine()->getManager()
57
       ->createQuery('
57
       ->createQuery('
58
         SELECT u FROM MuzichCoreBundle:User u
58
         SELECT u FROM MuzichCoreBundle:User u
59
         WHERE u.id IN (:uids)'
59
         WHERE u.id IN (:uids)'
65
     foreach ($users as $user)
65
     foreach ($users as $user)
66
     {
66
     {
67
       $user->addModeratedTagCount();
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
     if (!$this->getRequest()->isXmlHttpRequest())
73
     if (!$this->getRequest()->isXmlHttpRequest())
74
     {
74
     {

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

56
     $element->setComments($cm->get());
56
     $element->setComments($cm->get());
57
     $element->setCountCommentReport($cm->countCommentAlert());
57
     $element->setCountCommentReport($cm->countCommentAlert());
58
     
58
     
59
-    $this->getDoctrine()->getEntityManager()->persist($element);
59
+    $this->getDoctrine()->getManager()->persist($element);
60
     
60
     
61
     // On récupère les user qui ont signalés ce commentaire
61
     // On récupère les user qui ont signalés ce commentaire
62
-    $users = $this->getDoctrine()->getEntityManager()
62
+    $users = $this->getDoctrine()->getManager()
63
       ->createQuery('
63
       ->createQuery('
64
         SELECT u FROM MuzichCoreBundle:User u
64
         SELECT u FROM MuzichCoreBundle:User u
65
         WHERE u.id IN (:uids)'
65
         WHERE u.id IN (:uids)'
72
     foreach ($users as $user)
72
     foreach ($users as $user)
73
     {
73
     {
74
       $user->addBadReport();
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
     if (!$this->getRequest()->isXmlHttpRequest())
80
     if (!$this->getRequest()->isXmlHttpRequest())
81
     {
81
     {
104
     
104
     
105
     // On récupère l'auteur du commentaire pour lui incrémenté son compteur
105
     // On récupère l'auteur du commentaire pour lui incrémenté son compteur
106
     // de contenu modéré
106
     // de contenu modéré
107
-    $user = $this->getDoctrine()->getEntityManager()->getRepository('MuzichCoreBundle:User')
107
+    $user = $this->getDoctrine()->getManager()->getRepository('MuzichCoreBundle:User')
108
       ->findOneBy(array(
108
       ->findOneBy(array(
109
         'id' => $comment['u']['i']
109
         'id' => $comment['u']['i']
110
       ));
110
       ));
111
     
111
     
112
     $user->addModeratedCommentCount();
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
     if (!$this->getRequest()->isXmlHttpRequest())
118
     if (!$this->getRequest()->isXmlHttpRequest())
119
     {
119
     {

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

79
     // Event pour user d'un nouveau comment
79
     // Event pour user d'un nouveau comment
80
     $event->commentAdded($element, $this->getUser());
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
     // On récupère le html du li avec le comment pour la réponse
85
     // On récupère le html du li avec le comment pour la réponse
86
     $html = $this->render('MuzichCommentBundle:Comment:li.comment.html.twig', array(
86
     $html = $this->render('MuzichCommentBundle:Comment:li.comment.html.twig', array(
139
     // Si tout c'est bien passé on met a jour l'attribut de l'élément
139
     // Si tout c'est bien passé on met a jour l'attribut de l'élément
140
     $element->setComments($cm->get());
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
     return $this->jsonResponse(array(
145
     return $this->jsonResponse(array(
146
       'status' => 'success'
146
       'status' => 'success'
260
     $cm->update($this->getUser(), $date, $comment, $follow);
260
     $cm->update($this->getUser(), $date, $comment, $follow);
261
     $element->setComments($cm->get());
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
     if (null === ($comment_index = $cm->getIndex($this->getUserId(), $date)))
266
     if (null === ($comment_index = $cm->getIndex($this->getUserId(), $date)))
267
     {
267
     {
321
     $element->setComments($cm->get());
321
     $element->setComments($cm->get());
322
     $element->setCountCommentReport($cm->countCommentAlert());
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
     return $this->jsonResponse(array(
327
     return $this->jsonResponse(array(
328
       'status' => 'success'
328
       'status' => 'success'
360
     $element->setComments($cm->get());
360
     $element->setComments($cm->get());
361
     $element->setCountCommentReport($cm->countCommentAlert());
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
     return $this->jsonResponse(array(
366
     return $this->jsonResponse(array(
367
       'status' => 'success'
367
       'status' => 'success'

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

30
 //    
30
 //    
31
 //    $bux = $this->getUser('bux');
31
 //    $bux = $this->getUser('bux');
32
 //    $bux->setReputation(0);
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
 //    $bux = $this->getUser('bux');
36
 //    $bux = $this->getUser('bux');
37
 //    $this->assertEquals($bux->getReputation(), 0);
37
 //    $this->assertEquals($bux->getReputation(), 0);

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

199
         'followed' => $paul->getId()
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
     // On rafraichie la page
205
     // On rafraichie la page
206
     $this->crawler = $this->client->request('GET', 
206
     $this->crawler = $this->client->request('GET', 

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

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

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

49
         'Punk rock', 'Ska-punk', 'Skate punk', 'Synthpunk' 
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
     $response = $TagLike->getSimilarTags('punk', $bux->getId());
53
     $response = $TagLike->getSimilarTags('punk', $bux->getId());
54
     
54
     
55
     $this->assertEquals(count($cresults), count($response['tags']));
55
     $this->assertEquals(count($cresults), count($response['tags']));
72
       'Reggae'
72
       'Reggae'
73
     );
73
     );
74
     
74
     
75
-    $TagLike = new TagLike($this->getDoctrine()->getEntityManager());
75
+    $TagLike = new TagLike($this->getDoctrine()->getManager());
76
     $response = $TagLike->getSimilarTags('reggea', $bux->getId());
76
     $response = $TagLike->getSimilarTags('reggea', $bux->getId());
77
     
77
     
78
     $this->assertEquals(count($cresults), count($response['tags']));
78
     $this->assertEquals(count($cresults), count($response['tags']));
96
         'Punk rock', 'Ska-punk', 'Skate punk', 'Synthpunk' 
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
     $tags = $this->getTagsNames($result = $TagLike->getSimilarTags('punk', $bux->getId()));
100
     $tags = $this->getTagsNames($result = $TagLike->getSimilarTags('punk', $bux->getId()));
101
     
101
     
102
     $this->assertEquals($cresults, $tags);
102
     $this->assertEquals($cresults, $tags);
108
         'Punk rock', 'Ska-punk', 'Skate punk', 'Synthpunk' 
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
     $tags = $this->getTagsNames($result = $TagLike->getSimilarTags('anarcho punk', $bux->getId()));
112
     $tags = $this->getTagsNames($result = $TagLike->getSimilarTags('anarcho punk', $bux->getId()));
113
     
113
     
114
     $this->assertEquals($cresults, $tags);
114
     $this->assertEquals($cresults, $tags);
120
         'Punk rock', 'Ska-punk', 'Skate punk', 'Synthpunk' 
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
     $tags = $this->getTagsNames($result = $TagLike->getSimilarTags('punk anarcho', $bux->getId()));
124
     $tags = $this->getTagsNames($result = $TagLike->getSimilarTags('punk anarcho', $bux->getId()));
125
     
125
     
126
     $this->assertEquals($cresults, $tags);
126
     $this->assertEquals($cresults, $tags);
132
         'Punk rock', 'Ska-punk', 'Skate punk', 'Synthpunk' 
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
     $tags = $this->getTagsNames($result = $TagLike->getSimilarTags('punk anar', $bux->getId()));
136
     $tags = $this->getTagsNames($result = $TagLike->getSimilarTags('punk anar', $bux->getId()));
137
     
137
     
138
     $this->assertEquals($cresults, $tags);
138
     $this->assertEquals($cresults, $tags);
144
         'Pop-punk', 'Post-Punk', 'Punk rock', 'Ska-jazz', 'Skacore',  'Synthpunk' 
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
     $tags = $this->getTagsNames($result = $TagLike->getSimilarTags('ska punk', $bux->getId()));
148
     $tags = $this->getTagsNames($result = $TagLike->getSimilarTags('ska punk', $bux->getId()));
149
     
149
     
150
     $this->assertEquals($cresults, $tags);
150
     $this->assertEquals($cresults, $tags);
155
       'Horror punk'
155
       'Horror punk'
156
     );
156
     );
157
     
157
     
158
-    $TagLike = new TagLike($this->getDoctrine()->getEntityManager());
158
+    $TagLike = new TagLike($this->getDoctrine()->getManager());
159
     $tags = $this->getTagsNames($result = $TagLike->getSimilarTags('horror', $bux->getId()));
159
     $tags = $this->getTagsNames($result = $TagLike->getSimilarTags('horror', $bux->getId()));
160
     
160
     
161
     $this->assertEquals($cresults, $tags);
161
     $this->assertEquals($cresults, $tags);

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

162
       ->findOneByName('Ed Cox - La fanfare des teuffeurs (Hardcordian)')
162
       ->findOneByName('Ed Cox - La fanfare des teuffeurs (Hardcordian)')
163
     ;
163
     ;
164
     $element->addTag($tag_3);
164
     $element->addTag($tag_3);
165
-    $this->getDoctrine()->getEntityManager()->persist($element);
165
+    $this->getDoctrine()->getManager()->persist($element);
166
     
166
     
167
     // Ajout en tag favoris
167
     // Ajout en tag favoris
168
     $new_fav = new UsersTagsFavorites();
168
     $new_fav = new UsersTagsFavorites();
169
     $new_fav->setTag($tag_3);
169
     $new_fav->setTag($tag_3);
170
     $new_fav->setUser($bux);
170
     $new_fav->setUser($bux);
171
     $new_fav->setPosition(0);
171
     $new_fav->setPosition(0);
172
-    $this->getDoctrine()->getEntityManager()->persist($new_fav);
172
+    $this->getDoctrine()->getManager()->persist($new_fav);
173
     
173
     
174
     // Ajout en tag de groupe
174
     // Ajout en tag de groupe
175
     $group = $this->getDoctrine()->getRepository('MuzichCoreBundle:Group')
175
     $group = $this->getDoctrine()->getRepository('MuzichCoreBundle:Group')
180
     $new_fav->setTag($tag_3);
180
     $new_fav->setTag($tag_3);
181
     $new_fav->setGroup($group);
181
     $new_fav->setGroup($group);
182
     $new_fav->setPosition(0);
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
     // On check que ces netités soit en base
187
     // On check que ces netités soit en base
188
     // Et que celle qui vont suivre (après le remplacement) n'y soit pas
188
     // Et que celle qui vont suivre (après le remplacement) n'y soit pas
244
     ;
244
     ;
245
     $this->assertTrue(is_null($fav));
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
     // A ce stade les vérifications on été faites on lance le replace
250
     // A ce stade les vérifications on été faites on lance le replace
251
     // Test 3: On remplace
251
     // Test 3: On remplace
312
     ;
312
     ;
313
     $this->assertTrue(!is_null($fav));
313
     $this->assertTrue(!is_null($fav));
314
     
314
     
315
-    $this->getDoctrine()->getEntityManager()->persist($tag_3);
315
+    $this->getDoctrine()->getManager()->persist($tag_3);
316
     $this->clean();
316
     $this->clean();
317
   }
317
   }
318
   
318
   
327
     $tag4 = $this->getDoctrine()->getRepository('MuzichCoreBundle:Tag')
327
     $tag4 = $this->getDoctrine()->getRepository('MuzichCoreBundle:Tag')
328
       ->findOneByName('Xvlsd aoj 12');
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
       ), $bux->getTagsFavoritesQuick());
109
       ), $bux->getTagsFavoritesQuick());
110
     }
110
     }
111
     
111
     
112
-    $this->getDoctrine()->getEntityManager()->remove($bux_melodique);
112
+    $this->getDoctrine()->getManager()->remove($bux_melodique);
113
     $this->flush();
113
     $this->flush();
114
     
114
     
115
     $bux = $this->getUser('bux');
115
     $bux = $this->getUser('bux');

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

517
    */
517
    */
518
   public function getEntityManager()
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
    */
271
    */
272
   protected function findUserByUsername($username)
272
   protected function findUserByUsername($username)
273
   {
273
   {
274
-    return $this->getDoctrine()->getEntityManager()->getRepository('MuzichCoreBundle:User')
274
+    return $this->getDoctrine()->getManager()->getRepository('MuzichCoreBundle:User')
275
       ->findOneByUsername($username)
275
       ->findOneByUsername($username)
276
     ;
276
     ;
277
   }
277
   }
530
    */
530
    */
531
   protected function getEntityManager()
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
     
46
     
47
     $factory = new ElementManager(
47
     $factory = new ElementManager(
48
       $element, 
48
       $element, 
49
-      $this->getDoctrine()->getEntityManager(), 
49
+      $this->getDoctrine()->getManager(), 
50
       $this->_container
50
       $this->_container
51
     );
51
     );
52
     $factory->proceedFill($user);
52
     $factory->proceedFill($user);
71
     $element->setUrl($url);
71
     $element->setUrl($url);
72
     
72
     
73
     $factory = new ElementManager($element, 
73
     $factory = new ElementManager($element, 
74
-      $this->getDoctrine()->getEntityManager(), $this->_container);
74
+      $this->getDoctrine()->getManager(), $this->_container);
75
     $factory->proceedFill($user);
75
     $factory->proceedFill($user);
76
     
76
     
77
     return $element->getDatas();
77
     return $element->getDatas();
95
   
95
   
96
   protected function persist($entity)
96
   protected function persist($entity)
97
   {
97
   {
98
-    $this->getDoctrine()->getEntityManager()->persist($entity);
98
+    $this->getDoctrine()->getManager()->persist($entity);
99
   }
99
   }
100
   
100
   
101
   protected function flush()
101
   protected function flush()
102
   {
102
   {
103
-    $this->getDoctrine()->getEntityManager()->flush();
103
+    $this->getDoctrine()->getManager()->flush();
104
   }
104
   }
105
   
105
   
106
   /**
106
   /**
109
    */
109
    */
110
   protected function getEntityManager()
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
     }
102
     }
103
     
103
     
104
     $user = $this->getUser();
104
     $user = $this->getUser();
105
-    $em = $this->getDoctrine()->getEntityManager();
105
+    $em = $this->getDoctrine()->getManager();
106
     
106
     
107
     if ($user->getPersonalHash($id) != $token || !is_numeric($id)
107
     if ($user->getPersonalHash($id) != $token || !is_numeric($id)
108
       || !($element = $em->getRepository('MuzichCoreBundle:Element')->findOneById($id))
108
       || !($element = $em->getRepository('MuzichCoreBundle:Element')->findOneById($id))
271
     $viewed_user = $this->getUser();
271
     $viewed_user = $this->getUser();
272
     if ($user_id != $this->getUserId(true))
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
         ->findOneById($user_id, array())->getSingleResult();
275
         ->findOneById($user_id, array())->getSingleResult();
276
     }
276
     }
277
     
277
     

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

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

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

158
     }
158
     }
159
     else if ($type == 'user')
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
         ->findOneById($object_id, array())->getSingleResult();
162
         ->findOneById($object_id, array())->getSingleResult();
163
     }
163
     }
164
     else if ($type == 'group')
164
     else if ($type == 'group')
165
     {
165
     {
166
-      $object = $this->getDoctrine()->getEntityManager()->getRepository('MuzichCoreBundle:Group')
166
+      $object = $this->getDoctrine()->getManager()->getRepository('MuzichCoreBundle:Group')
167
         ->findOneById($object_id);
167
         ->findOneById($object_id);
168
     }
168
     }
169
     
169
     

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

51
   {
51
   {
52
     $ids = $event->getIds();
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
     $followers_users_new = array();
57
     $followers_users_new = array();
58
     foreach ($followers_users as $user)
58
     foreach ($followers_users as $user)

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

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