Browse Source

Merge branch 'stable/v0.9.9' into feature/v0.9.9/plugin

Bastien Sevajol 11 years ago
parent
commit
2bd11ae5e2
35 changed files with 592 additions and 531 deletions
  1. 2 0
      app/Resources/translations/elements.en.yml
  2. 1 0
      app/Resources/translations/elements.fr.yml
  3. 8 8
      src/Muzich/AdminBundle/Controller/Moderate_comment/EditController.php
  4. 7 7
      src/Muzich/AdminBundle/Controller/Moderate_element/EditController.php
  5. 3 3
      src/Muzich/AdminBundle/Controller/Moderate_tag/EditController.php
  6. 8 8
      src/Muzich/AdminBundle/Controller/Moderate_user/EditController.php
  7. 10 10
      src/Muzich/CommentBundle/Controller/CommentController.php
  8. 8 8
      src/Muzich/CoreBundle/Controller/CoreController.php
  9. 26 24
      src/Muzich/CoreBundle/Controller/ElementController.php
  10. 2 2
      src/Muzich/CoreBundle/Controller/SearchController.php
  11. 339 330
      src/Muzich/CoreBundle/Repository/ElementRepository.php
  12. 12 0
      src/Muzich/CoreBundle/Resources/public/js/muzich.js
  13. 15 1
      src/Muzich/CoreBundle/Resources/views/Tag/tag_cloud.html.twig
  14. 10 1
      src/Muzich/CoreBundle/Searcher/ElementSearcher.php
  15. 29 26
      src/Muzich/CoreBundle/Searcher/ElementSearcherQueryBuilder.php
  16. 20 20
      src/Muzich/CoreBundle/Tests/Controller/ElementControllerTest.php
  17. 28 28
      src/Muzich/CoreBundle/Tests/Controller/EventTest.php
  18. 3 3
      src/Muzich/CoreBundle/Tests/Controller/FavoriteControllerTest.php
  19. 1 1
      src/Muzich/CoreBundle/Tests/Controller/HomeControllerTest.php
  20. 2 2
      src/Muzich/CoreBundle/Tests/Controller/IndexControllerTest.php
  21. 2 2
      src/Muzich/CoreBundle/Tests/Controller/ReputationTest.php
  22. 2 2
      src/Muzich/CoreBundle/Tests/Controller/ShowControllerTest.php
  23. 1 1
      src/Muzich/CoreBundle/Tests/Controller/UserControllerTest.php
  24. 8 8
      src/Muzich/CoreBundle/Tests/Tag/TagReadTest.php
  25. 12 12
      src/Muzich/CoreBundle/Tests/Tag/TagWriteTest.php
  26. 1 1
      src/Muzich/CoreBundle/Tests/User/UserTest.php
  27. 9 1
      src/Muzich/CoreBundle/lib/Controller.php
  28. 2 2
      src/Muzich/CoreBundle/lib/FunctionalTest.php
  29. 5 5
      src/Muzich/CoreBundle/lib/UnitTest.php
  30. 2 2
      src/Muzich/FavoriteBundle/Controller/FavoriteController.php
  31. 3 3
      src/Muzich/GroupBundle/Controller/DefaultController.php
  32. 2 2
      src/Muzich/HomeBundle/Controller/ShowController.php
  33. 2 2
      src/Muzich/MynetworkBundle/Controller/MynetworkController.php
  34. 2 1
      src/Muzich/PlaylistBundle/Resources/views/Show/user.html.twig
  35. 5 5
      src/Muzich/UserBundle/Controller/UserController.php

+ 2 - 0
app/Resources/translations/elements.en.yml View File

@@ -9,6 +9,8 @@ noelements:
9 9
   
10 10
   sentence_filter_link_string: delete them.
11 11
   
12
+  nofound_anymore:      Share not found (maybe deleted by owner)
13
+  
12 14
 element:
13 15
   favorite:
14 16
     add:                Add to faves

+ 1 - 0
app/Resources/translations/elements.fr.yml View File

@@ -8,6 +8,7 @@ noelements:
8 8
                          <br />Vous pouvez ajouter des tags ou
9 9
                          <a class="filter_clear_url" href="#" >%link_string%</a>.
10 10
   sentence_filter_link_string: les retirer
11
+  nofound_anymore:      Le partage est introuvable (il peut avoir été supprimé par son auteur)
11 12
   
12 13
 element:
13 14
   favorite:

+ 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'

+ 26 - 24
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
     {
@@ -1085,8 +1085,10 @@ class ElementController extends Controller
1085 1085
     if (!($element = $es->getElements($this->getDoctrine(), $this->getUserId(true), 'single')))
1086 1086
     {
1087 1087
       return $this->jsonResponse(array(
1088
-      'status'  => 'error'
1089
-    ));
1088
+        self::RESPONSE_STATUS_ID  => self::RESPONSE_STATUS_ERROR,
1089
+        self::RESPONSE_ERROR_ID   => self::ERROR_TYPE_NOTFOUND,
1090
+        self::RESPONSE_MESSAGE_ID => $this->trans('noelements.nofound_anymore', array(), 'elements')
1091
+      ));
1090 1092
     }
1091 1093
     
1092 1094
     $html = $this->render('MuzichCoreBundle:SearchElement:li.element.html.twig', array(

+ 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"

+ 339 - 330
src/Muzich/CoreBundle/Repository/ElementRepository.php View File

@@ -54,332 +54,332 @@ class ElementRepository extends EntityRepository
54 54
   
55 55
   
56 56
   
57
-  /**
58
-   * TODO: Faire un bel objet pour gérer tout ça =)
59
-   * => Utiliser l'objet ElementSearcher (ou du moin réorganiser ça en plusieurs 
60
-   * objets)
61
-   * 
62
-   * 
63
-   * @param ElementSearcher $searcher
64
-   * @return Doctrine\ORM\Query
65
-   */
66
-  public function findBySearchOLD(ElementSearcher $searcher, $user_id, $exec_type = 'execute', $params = array())
67
-  {
68
-    // Tableaux des paramétres
69
-    $params_ids = array();
70
-    $params_select = array();
71
-    $params_select['uid'] = $user_id;
72
-    $order_by = "ORDER BY e_.created DESC, e_.id DESC";
73
-    
74
-    // Première chose, si on impose les element_ids on a pas besoin de faire 
75
-    // le filtrage
76
-    if ($searcher->hasIds())
77
-    {
78
-      // Dans ce cas ou les ids sont déjà donné, on ne peut pas avoir de nouveaux
79
-      // éléments
80
-      if ($searcher->isSearchingNew())
81
-      {
82
-        return $query = $this->getEntityManager()
83
-          ->createQuery("SELECT e FROM MuzichCoreBundle:Element e WHERE 1 = 2")
84
-        ;
85
-      }
86
-      
87
-      if (($id_limit = $searcher->getIdLimit()))
88
-      {
89
-        return $this->getSelectElementForSearchQuery($params_select, $user_id, $searcher->getIds(), $id_limit, $searcher->getCount(), $searcher->getIdsDisplay());
90
-      }
91
-      return $this->getSelectElementForSearchQuery($params_select, $user_id, $searcher->getIds(), null, null, $searcher->getIdsDisplay());
92
-    }
93
-    
94
-    // Booléen nous permettant de savoir si un where a déjà été écrit
95
-    $is_where = false;
96
-    
97
-    // Si c'est une recherche string, les autres paramètres ne sont pas nécéssaire
98
-    // TODO: Dans la nouvelle version ourquoi pas !!
99
-    // TODOOO: Pas encore dans new version (string)
100
-    $where_string = '';
101
-    if (($string = $searcher->getString()))
102
-    {
103
-      // On prépare notre liste de mots
104
-      $words = array_unique(array_merge(
105
-        explode(' ', $string),
106
-        explode('-', $string),
107
-        explode('- ', $string),
108
-        explode(' -', $string),
109
-        explode(' - ', $string),
110
-        explode(',', $string),
111
-        explode(', ', $string),
112
-        explode(' ,', $string),
113
-        explode(' , ', $string)
114
-      ));
115
-      
116
-      // On récupère les ids des elements correspondants
117
-      $word_min_length = 0;
118
-      if (isset($params['word_min_length']))
119
-      {
120
-        $word_min_length = $params['word_min_length'];
121
-      }
122
-      foreach ($words as $i => $word)
123
-      {
124
-        if (strlen($word) >= $word_min_length)
125
-        {
126
-          if ($where_string === '')
127
-          {
128
-            $where_string = ($is_where) ? ' AND (' : ' WHERE (';
129
-            $is_where = true;
130
-            $where_string .= "UPPER(e_.name) LIKE :str".$i;
131
-          }
132
-          else
133
-          {
134
-            $where_string .= " OR UPPER(e_.name) LIKE :str".$i;
135
-          }
136
-          $params_ids['str'.$i] = '%'.strtoupper($word).'%';
137
-        }
138
-      }
139
-      $where_string .= ')';
140
-      
141
-    }
142
-    
143
-    
144
-    // Construction des conditions pour la selection d'ids
145
-    $where_tags = '';
146
-    $join_tags  = '';
147
-    
148
-    /*
149
-     * des fois on se retrouve avec un string au lieu d'un tableau
150
-     */
151
-    $tags = $searcher->getTags();
152
-    
153
-    if (!is_array($tags))
154
-    {
155
-      $tags_decoded = json_decode($tags);
156
-      $tags = array();
157
-      foreach ($tags_decoded as $tag_id)
158
-      {
159
-        $tags[$tag_id] = $tag_id;
160
-      }
161
-    }
162
-    
163
-    if (count($tags))
164
-    {
165
-      foreach ($tags as $tag_id => $tag_name)
166
-      {
167
-        // LEFT JOIN car un element n'est pas obligatoirement lié a un/des tags
168
-        $join_tags = " LEFT JOIN e_.tags t_";
169
-
170
-        // Construction du chere pour les tags
171
-        if ($where_tags == '')
172
-        {
173
-          $where_tags .= ' WHERE (t_.id = :tid'.$tag_id;
174
-        }
175
-        else
176
-        {
177
-          $where_tags .= ' OR t_.id = :tid'.$tag_id;
178
-        }
179
-        $params_ids['tid'.$tag_id] = $tag_id;
180
-      }
181
-      // Fermeture de la parenthése qui isole la condition des tags
182
-      $where_tags .= ')';
183
-      $is_where = true;
184
-    }
185
-    
186
-    // Construction de la condition network
187
-    $join_network  = '';
188
-    $where_network = '';
189
-    if ($searcher->getNetwork() == ElementSearcher::NETWORK_PERSONAL)
190
-    {
191
-      $join_network = 
192
-        " JOIN e_.owner o_"
193
-      // LEFT JOIN car l'element n'est pas obligatoirement lié a un groupe
194
-      . " LEFT JOIN e_.group g_"
195
-      // LEFT JOIN car owner n'est pas obligatoirement lié a des followers
196
-      . " LEFT JOIN o_.followers_users f_"
197
-      // LEFT JOIN car le groupe n'est pas obligatoirement lié a des followers
198
-      . " LEFT JOIN g_.followers gf_"
199
-      ;
200
-      $where_network = ($is_where) ? ' AND' : ' WHERE';
201
-      $is_where = true;
202
-      // Le filtre applique: Soit le proprio fait partis des followeds de l'utilisateur
203
-      // soit l'element est ajouté dans un groupe que l'utilisateur follow.
204
-      $where_network .= ' (f_.follower = :userid OR gf_.follower = :useridg)';
205
-      $params_ids['userid'] = $user_id;
206
-      $params_ids['useridg'] = $user_id;
207
-    }
208
-    
209
-    // ajout du filtre sur un user si c'est le cas
210
-    $where_user = '';
211
-    //                                                  Si c'est une recherche 
212
-    //                de favoris, on ne filtre pas sur le proprio de l'element
213
-    if (($search_user_id = $searcher->getUserId()) && !$searcher->isFavorite())
214
-    {
215
-      $where_user = ($is_where) ? ' AND' : ' WHERE';
216
-      $is_where = true;
217
-      $where_user .= ' e_.owner = :suid';
218
-      $params_ids['suid'] = $search_user_id;
219
-    }
220
-    
221
-    // ajout du filtre sur un user si c'est le cas
222
-    $where_group = '';
223
-    //                                                 Si c'est une recherche 
224
-    //               de favoris, on ne filtre pas sur le proprio de l'element
225
-    if (($search_group_id = $searcher->getGroupId()) && !$searcher->isFavorite())
226
-    {
227
-      $where_group = ($is_where) ? ' AND' : ' WHERE';
228
-      $is_where = true;
229
-      $where_group .= ' e_.group = :sgid';
230
-      $params_ids['sgid'] = $search_group_id;
231
-    }
232
-    
233
-    // Filtre pour afficher uniquement les elements mis en favoris
234
-    $join_favorite = ''; 
235
-    $where_favorite = '';
236
-    if ($searcher->isFavorite())
237
-    {
238
-      $where_favorite = ($is_where) ? ' AND' : ' WHERE';
239
-      $is_where = true;
240
-      if (($favorite_user_id = $searcher->getUserId()) && !$searcher->getGroupId())
241
-      {
242
-        // Pas de LEFT JOIN car on ne veut que les elements mis en favoris
243
-        $join_favorite = 'JOIN e_.elements_favorites fav2_';
244
-        $where_favorite .= ' fav2_.user = :fuid';
245
-        $params_ids['fuid'] = $favorite_user_id;
246
-      }
247
-      else if (($favorite_group_id = $searcher->getGroupId()) && !$searcher->getUserId())
248
-      {
249
-        // TODO: Faire en sorte que ça affiche les favoris des gens suivant
250
-        // le groupe
251
-      }
252
-      else
253
-      {
254
-        throw new Exception('For use favorite search element, you must specify an user_id or group_id');
255
-      }
256
-    }
257
-    
258
-    // Si id_limit est précisé c'est que l'on demande "la suite" ou "les nouveaux"
259
-    $where_id_limit = '';
260
-    if (($id_limit = $searcher->getIdLimit()) && !$searcher->isSearchingNew())
261
-    {
262
-      $where_id_limit = ($is_where) ? ' AND' : ' WHERE';
263
-      $is_where = true;
264
-      $where_id_limit .= " e_.id < :id_limit";
265
-      $params_ids['id_limit'] = $id_limit;
266
-    }
267
-    elseif ($id_limit && $searcher->isSearchingNew())
268
-    {
269
-      $where_id_limit = ($is_where) ? ' AND' : ' WHERE';
270
-      $is_where = true;
271
-      $where_id_limit .= " e_.id > :id_limit";
272
-      $params_ids['id_limit'] = $id_limit;
273
-      // Pour pouvoir charger les x nouveaux on doit organiser la liste 
274
-      // de manière croissante
275
-      $order_by = "ORDER BY e_.created ASC, e_.id ASC";
276
-    }
277
-    
278
-    
279
-    // Recherche strict ou non ?
280
-    $where_tag_strict = '';
281
-    if ($searcher->getTagStrict() && count($tags))
282
-    {
283
-      // On a besoin de récupérer la liste des element_id qui ont les tags
284
-      // demandés.
285
-      $tag_ids = '';
286
-      foreach ($tags as $tag_id => $tag_name)
287
-      {
288
-        if ($tag_ids === '')
289
-        {
290
-          $tag_ids .= (int)$tag_id;
291
-        }
292
-        else
293
-        {
294
-          $tag_ids .= ','.(int)$tag_id;
295
-        }
296
-      }
297
-      
298
-      $sql = "SELECT et.element_id FROM elements_tag et "
299
-      ."WHERE et.tag_id IN ($tag_ids) group by et.element_id "
300
-      ."having count(distinct et.tag_id) = ".count($tags);
301
-      $rsm = new \Doctrine\ORM\Query\ResultSetMapping;
302
-      $rsm->addScalarResult('element_id', 'element_id');
303
-      
304
-      $strict_element_ids_result = $this->getEntityManager()
305
-        ->createNativeQuery($sql, $rsm)
306
-        //->setParameter('ids', $tag_ids)
307
-        ->getScalarResult()
308
-      ;
309
-      
310
-      $strict_element_ids = array();
311
-      foreach ($strict_element_ids_result as $strict_id)
312
-      {
313
-        $strict_element_ids[] = $strict_id['element_id'];
314
-      }
315
-      
316
-      if (count($strict_element_ids))
317
-      {
318
-        $where_tag_strict = ($is_where) ? ' AND' : ' WHERE';
319
-        $where_tag_strict .= ' e_.id IN (:tag_strict_ids)';
320
-        $params_ids['tag_strict_ids'] = $strict_element_ids;
321
-      }
322
-      // Ce else palie au bug du au cas ou $strict_element_ids est egal a array();
323
-      else
324
-      {
325
-        $where_tag_strict = ($is_where) ? ' AND' : ' WHERE';
326
-        $where_tag_strict .= ' 1 = 2';
327
-      }
328
-    }
329
-    
330
-    // Requête qui selectionnera les ids en fonction des critéres
331
-    $id_query = $this->getEntityManager()
332
-      ->createQuery(
333
-        "SELECT e_.id
334
-        FROM MuzichCoreBundle:Element e_
335
-        $join_tags
336
-        $join_network
337
-        $join_favorite
338
-        $where_tags
339
-        $where_network
340
-        $where_user
341
-        $where_group
342
-        $where_favorite
343
-        $where_tag_strict
344
-        $where_string
345
-        $where_id_limit
346
-        GROUP BY e_.id
347
-        $order_by")
348
-     ->setParameters($params_ids)
349
-    ;
350
-    
351
-    // Si on a précisé que l'on voulait un count, pas de limite
352
-    if ($exec_type != 'count')
353
-    {
354
-      $id_query->setMaxResults($searcher->getCount());
355
-    }
356
-    
357
-    // si l'on a demandé un count
358
-    if ($exec_type == 'count')
359
-    {
360
-      // On retourne cette query
361
-      return $id_query;
362
-    }
363
-    
364
-    $r_ids = $id_query->getArrayResult();
365
-    
366
-    $ids = array();
367
-    
368
-    if (count($r_ids))
369
-    {
370
-      foreach ($r_ids as $r_id)
371
-      {
372
-        $ids[] = $r_id['id'];
373
-      }
374
-
375
-      return $this->getSelectElementForSearchQuery($params_select, $user_id, $ids);
376
-    }
377
-    
378
-    // Il faut retourner une Query
379
-    return $query = $this->getEntityManager()
380
-      ->createQuery("SELECT e FROM MuzichCoreBundle:Element e WHERE 1 = 2")
381
-    ;
382
-  }
57
+//  /**
58
+//   * TODO: Faire un bel objet pour gérer tout ça =)
59
+//   * => Utiliser l'objet ElementSearcher (ou du moin réorganiser ça en plusieurs 
60
+//   * objets)
61
+//   * 
62
+//   * 
63
+//   * @param ElementSearcher $searcher
64
+//   * @return Doctrine\ORM\Query
65
+//   */
66
+//  public function findBySearchOLD(ElementSearcher $searcher, $user_id, $exec_type = 'execute', $params = array())
67
+//  {
68
+//    // Tableaux des paramétres
69
+//    $params_ids = array();
70
+//    $params_select = array();
71
+//    $params_select['uid'] = $user_id;
72
+//    $order_by = "ORDER BY e_.created DESC, e_.id DESC";
73
+//    
74
+//    // Première chose, si on impose les element_ids on a pas besoin de faire 
75
+//    // le filtrage
76
+//    if ($searcher->hasIds())
77
+//    {
78
+//      // Dans ce cas ou les ids sont déjà donné, on ne peut pas avoir de nouveaux
79
+//      // éléments
80
+//      if ($searcher->isSearchingNew())
81
+//      {
82
+//        return $query = $this->getEntityManager()
83
+//          ->createQuery("SELECT e FROM MuzichCoreBundle:Element e WHERE 1 = 2")
84
+//        ;
85
+//      }
86
+//      
87
+//      if (($id_limit = $searcher->getIdLimit()))
88
+//      {
89
+//        return $this->getSelectElementForSearchQuery($params_select, $user_id, $searcher->getIds(), $id_limit, $searcher->getCount(), $searcher->getIdsDisplay());
90
+//      }
91
+//      return $this->getSelectElementForSearchQuery($params_select, $user_id, $searcher->getIds(), null, null, $searcher->getIdsDisplay());
92
+//    }
93
+//    
94
+//    // Booléen nous permettant de savoir si un where a déjà été écrit
95
+//    $is_where = false;
96
+//    
97
+//    // Si c'est une recherche string, les autres paramètres ne sont pas nécéssaire
98
+//    // TODO: Dans la nouvelle version ourquoi pas !!
99
+//    // TODOOO: Pas encore dans new version (string)
100
+//    $where_string = '';
101
+//    if (($string = $searcher->getString()))
102
+//    {
103
+//      // On prépare notre liste de mots
104
+//      $words = array_unique(array_merge(
105
+//        explode(' ', $string),
106
+//        explode('-', $string),
107
+//        explode('- ', $string),
108
+//        explode(' -', $string),
109
+//        explode(' - ', $string),
110
+//        explode(',', $string),
111
+//        explode(', ', $string),
112
+//        explode(' ,', $string),
113
+//        explode(' , ', $string)
114
+//      ));
115
+//      
116
+//      // On récupère les ids des elements correspondants
117
+//      $word_min_length = 0;
118
+//      if (isset($params['word_min_length']))
119
+//      {
120
+//        $word_min_length = $params['word_min_length'];
121
+//      }
122
+//      foreach ($words as $i => $word)
123
+//      {
124
+//        if (strlen($word) >= $word_min_length)
125
+//        {
126
+//          if ($where_string === '')
127
+//          {
128
+//            $where_string = ($is_where) ? ' AND (' : ' WHERE (';
129
+//            $is_where = true;
130
+//            $where_string .= "UPPER(e_.name) LIKE :str".$i;
131
+//          }
132
+//          else
133
+//          {
134
+//            $where_string .= " OR UPPER(e_.name) LIKE :str".$i;
135
+//          }
136
+//          $params_ids['str'.$i] = '%'.strtoupper($word).'%';
137
+//        }
138
+//      }
139
+//      $where_string .= ')';
140
+//      
141
+//    }
142
+//    
143
+//    
144
+//    // Construction des conditions pour la selection d'ids
145
+//    $where_tags = '';
146
+//    $join_tags  = '';
147
+//    
148
+//    /*
149
+//     * des fois on se retrouve avec un string au lieu d'un tableau
150
+//     */
151
+//    $tags = $searcher->getTags();
152
+//    
153
+//    if (!is_array($tags))
154
+//    {
155
+//      $tags_decoded = json_decode($tags);
156
+//      $tags = array();
157
+//      foreach ($tags_decoded as $tag_id)
158
+//      {
159
+//        $tags[$tag_id] = $tag_id;
160
+//      }
161
+//    }
162
+//    
163
+//    if (count($tags))
164
+//    {
165
+//      foreach ($tags as $tag_id => $tag_name)
166
+//      {
167
+//        // LEFT JOIN car un element n'est pas obligatoirement lié a un/des tags
168
+//        $join_tags = " LEFT JOIN e_.tags t_";
169
+//
170
+//        // Construction du chere pour les tags
171
+//        if ($where_tags == '')
172
+//        {
173
+//          $where_tags .= ' WHERE (t_.id = :tid'.$tag_id;
174
+//        }
175
+//        else
176
+//        {
177
+//          $where_tags .= ' OR t_.id = :tid'.$tag_id;
178
+//        }
179
+//        $params_ids['tid'.$tag_id] = $tag_id;
180
+//      }
181
+//      // Fermeture de la parenthése qui isole la condition des tags
182
+//      $where_tags .= ')';
183
+//      $is_where = true;
184
+//    }
185
+//    
186
+//    // Construction de la condition network
187
+//    $join_network  = '';
188
+//    $where_network = '';
189
+//    if ($searcher->getNetwork() == ElementSearcher::NETWORK_PERSONAL)
190
+//    {
191
+//      $join_network = 
192
+//        " JOIN e_.owner o_"
193
+//      // LEFT JOIN car l'element n'est pas obligatoirement lié a un groupe
194
+//      . " LEFT JOIN e_.group g_"
195
+//      // LEFT JOIN car owner n'est pas obligatoirement lié a des followers
196
+//      . " LEFT JOIN o_.followers_users f_"
197
+//      // LEFT JOIN car le groupe n'est pas obligatoirement lié a des followers
198
+//      . " LEFT JOIN g_.followers gf_"
199
+//      ;
200
+//      $where_network = ($is_where) ? ' AND' : ' WHERE';
201
+//      $is_where = true;
202
+//      // Le filtre applique: Soit le proprio fait partis des followeds de l'utilisateur
203
+//      // soit l'element est ajouté dans un groupe que l'utilisateur follow.
204
+//      $where_network .= ' (f_.follower = :userid OR gf_.follower = :useridg)';
205
+//      $params_ids['userid'] = $user_id;
206
+//      $params_ids['useridg'] = $user_id;
207
+//    }
208
+//    
209
+//    // ajout du filtre sur un user si c'est le cas
210
+//    $where_user = '';
211
+//    //                                                  Si c'est une recherche 
212
+//    //                de favoris, on ne filtre pas sur le proprio de l'element
213
+//    if (($search_user_id = $searcher->getUserId()) && !$searcher->isFavorite())
214
+//    {
215
+//      $where_user = ($is_where) ? ' AND' : ' WHERE';
216
+//      $is_where = true;
217
+//      $where_user .= ' e_.owner = :suid';
218
+//      $params_ids['suid'] = $search_user_id;
219
+//    }
220
+//    
221
+//    // ajout du filtre sur un user si c'est le cas
222
+//    $where_group = '';
223
+//    //                                                 Si c'est une recherche 
224
+//    //               de favoris, on ne filtre pas sur le proprio de l'element
225
+//    if (($search_group_id = $searcher->getGroupId()) && !$searcher->isFavorite())
226
+//    {
227
+//      $where_group = ($is_where) ? ' AND' : ' WHERE';
228
+//      $is_where = true;
229
+//      $where_group .= ' e_.group = :sgid';
230
+//      $params_ids['sgid'] = $search_group_id;
231
+//    }
232
+//    
233
+//    // Filtre pour afficher uniquement les elements mis en favoris
234
+//    $join_favorite = ''; 
235
+//    $where_favorite = '';
236
+//    if ($searcher->isFavorite())
237
+//    {
238
+//      $where_favorite = ($is_where) ? ' AND' : ' WHERE';
239
+//      $is_where = true;
240
+//      if (($favorite_user_id = $searcher->getUserId()) && !$searcher->getGroupId())
241
+//      {
242
+//        // Pas de LEFT JOIN car on ne veut que les elements mis en favoris
243
+//        $join_favorite = 'JOIN e_.elements_favorites fav2_';
244
+//        $where_favorite .= ' fav2_.user = :fuid';
245
+//        $params_ids['fuid'] = $favorite_user_id;
246
+//      }
247
+//      else if (($favorite_group_id = $searcher->getGroupId()) && !$searcher->getUserId())
248
+//      {
249
+//        // TODO: Faire en sorte que ça affiche les favoris des gens suivant
250
+//        // le groupe
251
+//      }
252
+//      else
253
+//      {
254
+//        throw new Exception('For use favorite search element, you must specify an user_id or group_id');
255
+//      }
256
+//    }
257
+//    
258
+//    // Si id_limit est précisé c'est que l'on demande "la suite" ou "les nouveaux"
259
+//    $where_id_limit = '';
260
+//    if (($id_limit = $searcher->getIdLimit()) && !$searcher->isSearchingNew())
261
+//    {
262
+//      $where_id_limit = ($is_where) ? ' AND' : ' WHERE';
263
+//      $is_where = true;
264
+//      $where_id_limit .= " e_.id < :id_limit";
265
+//      $params_ids['id_limit'] = $id_limit;
266
+//    }
267
+//    elseif ($id_limit && $searcher->isSearchingNew())
268
+//    {
269
+//      $where_id_limit = ($is_where) ? ' AND' : ' WHERE';
270
+//      $is_where = true;
271
+//      $where_id_limit .= " e_.id > :id_limit";
272
+//      $params_ids['id_limit'] = $id_limit;
273
+//      // Pour pouvoir charger les x nouveaux on doit organiser la liste 
274
+//      // de manière croissante
275
+//      $order_by = "ORDER BY e_.created ASC, e_.id ASC";
276
+//    }
277
+//    
278
+//    
279
+//    // Recherche strict ou non ?
280
+//    $where_tag_strict = '';
281
+//    if ($searcher->getTagStrict() && count($tags))
282
+//    {
283
+//      // On a besoin de récupérer la liste des element_id qui ont les tags
284
+//      // demandés.
285
+//      $tag_ids = '';
286
+//      foreach ($tags as $tag_id => $tag_name)
287
+//      {
288
+//        if ($tag_ids === '')
289
+//        {
290
+//          $tag_ids .= (int)$tag_id;
291
+//        }
292
+//        else
293
+//        {
294
+//          $tag_ids .= ','.(int)$tag_id;
295
+//        }
296
+//      }
297
+//      
298
+//      $sql = "SELECT et.element_id FROM elements_tag et "
299
+//      ."WHERE et.tag_id IN ($tag_ids) group by et.element_id "
300
+//      ."having count(distinct et.tag_id) = ".count($tags);
301
+//      $rsm = new \Doctrine\ORM\Query\ResultSetMapping;
302
+//      $rsm->addScalarResult('element_id', 'element_id');
303
+//      
304
+//      $strict_element_ids_result = $this->getEntityManager()
305
+//        ->createNativeQuery($sql, $rsm)
306
+//        //->setParameter('ids', $tag_ids)
307
+//        ->getScalarResult()
308
+//      ;
309
+//      
310
+//      $strict_element_ids = array();
311
+//      foreach ($strict_element_ids_result as $strict_id)
312
+//      {
313
+//        $strict_element_ids[] = $strict_id['element_id'];
314
+//      }
315
+//      
316
+//      if (count($strict_element_ids))
317
+//      {
318
+//        $where_tag_strict = ($is_where) ? ' AND' : ' WHERE';
319
+//        $where_tag_strict .= ' e_.id IN (:tag_strict_ids)';
320
+//        $params_ids['tag_strict_ids'] = $strict_element_ids;
321
+//      }
322
+//      // Ce else palie au bug du au cas ou $strict_element_ids est egal a array();
323
+//      else
324
+//      {
325
+//        $where_tag_strict = ($is_where) ? ' AND' : ' WHERE';
326
+//        $where_tag_strict .= ' 1 = 2';
327
+//      }
328
+//    }
329
+//    
330
+//    // Requête qui selectionnera les ids en fonction des critéres
331
+//    $id_query = $this->getEntityManager()
332
+//      ->createQuery(
333
+//        "SELECT e_.id
334
+//        FROM MuzichCoreBundle:Element e_
335
+//        $join_tags
336
+//        $join_network
337
+//        $join_favorite
338
+//        $where_tags
339
+//        $where_network
340
+//        $where_user
341
+//        $where_group
342
+//        $where_favorite
343
+//        $where_tag_strict
344
+//        $where_string
345
+//        $where_id_limit
346
+//        GROUP BY e_.id
347
+//        $order_by")
348
+//     ->setParameters($params_ids)
349
+//    ;
350
+//    
351
+//    // Si on a précisé que l'on voulait un count, pas de limite
352
+//    if ($exec_type != 'count')
353
+//    {
354
+//      $id_query->setMaxResults($searcher->getCount());
355
+//    }
356
+//    
357
+//    // si l'on a demandé un count
358
+//    if ($exec_type == 'count')
359
+//    {
360
+//      // On retourne cette query
361
+//      return $id_query;
362
+//    }
363
+//    
364
+//    $r_ids = $id_query->getArrayResult();
365
+//    
366
+//    $ids = array();
367
+//    
368
+//    if (count($r_ids))
369
+//    {
370
+//      foreach ($r_ids as $r_id)
371
+//      {
372
+//        $ids[] = $r_id['id'];
373
+//      }
374
+//
375
+//      return $this->getSelectElementForSearchQuery($params_select, $user_id, $ids);
376
+//    }
377
+//    
378
+//    // Il faut retourner une Query
379
+//    return $query = $this->getEntityManager()
380
+//      ->createQuery("SELECT e FROM MuzichCoreBundle:Element e WHERE 1 = 2")
381
+//    ;
382
+//  }
383 383
   
384 384
   protected function getSelectElementForSearchQuery($params_select, $user_id, $ids, $id_limit = null, $count_limit = null, $ids_display = null)
385 385
   {
@@ -518,12 +518,21 @@ class ElementRepository extends EntityRepository
518 518
     $doctrineConfig = $this->getEntityManager()->getConfiguration();
519 519
     $doctrineConfig->addCustomStringFunction('FIELD', 'Muzich\CoreBundle\DoctrineExtensions\Query\Mysql\Field');
520 520
     
521
+    if (count($element_ids))
522
+    {
523
+      return $this->getEntityManager()->createQueryBuilder()
524
+        ->select('e, field(e.id, ' . implode(', ', $element_ids) . ') as HIDDEN field')
525
+        ->from('MuzichCoreBundle:Element', 'e')
526
+        ->where('e.id IN (:element_ids)')
527
+        ->setParameter('element_ids', $element_ids)
528
+        ->orderBy('field')
529
+      ;
530
+    }
531
+    
521 532
     return $this->getEntityManager()->createQueryBuilder()
522
-      ->select('e, field(e.id, ' . implode(', ', $element_ids) . ') as HIDDEN field')
533
+      ->select('e')
523 534
       ->from('MuzichCoreBundle:Element', 'e')
524
-      ->where('e.id IN (:element_ids)')
525
-      ->setParameter('element_ids', $element_ids)
526
-      ->orderBy('field')
535
+      ->where('1 = 2')
527 536
     ;
528 537
   }
529 538
   

+ 12 - 0
src/Muzich/CoreBundle/Resources/public/js/muzich.js View File

@@ -2568,6 +2568,12 @@ $(document).ready(function(){
2568 2568
     $(this).hide();
2569 2569
   });
2570 2570
   
2571
+  $('a.display_all_cloud_tag').click(function(){
2572
+    $(this).parents('ul.tags_cloud').find('li').show();
2573
+    $(this).parent().remove();
2574
+    return false;
2575
+  });
2576
+  
2571 2577
   $('input#cloud_tags_filter').keyup(function(){
2572 2578
     var search_string = $(this).val();
2573 2579
     
@@ -3141,10 +3147,16 @@ $(document).ready(function(){
3141 3147
           function(){}
3142 3148
         );
3143 3149
 
3150
+        line.find('img.loader').hide();
3144 3151
         if (response.status === 'success')
3145 3152
         {
3146 3153
           line.find('div.content_opened').html('<ul class="elements">' + response.data + '</ul>');
3147 3154
         }
3155
+        else
3156
+        if (response.status === 'error')
3157
+        {
3158
+          line.find('div.content_opened').html(response.message);
3159
+        }
3148 3160
       });
3149 3161
     }
3150 3162
     else

+ 15 - 1
src/Muzich/CoreBundle/Resources/views/Tag/tag_cloud.html.twig View File

@@ -1,10 +1,24 @@
1
+{% if tags_display_limit is not defined %}
2
+  {% set tags_display_limit = cloud_tags_limit_to_display %}
3
+{% endif %}
4
+
1 5
 <ul class="tags_cloud">
2 6
   {% for key, tag in tags %}
3
-    <li class="{{ css_list_length_class(key, tags|length) }}" {% if loop.index0 > cloud_tags_limit_to_display %}style="display: none;"{% endif %}>
7
+    <li class="{{ css_list_length_class(key, tags|length) }}" {% if loop.index0 > tags_display_limit %}style="display: none;"{% endif %}>
4 8
       <a data-tagid="{{ tag.id }}" href="#" class="tag">
5 9
         {{ tag.name }}
6 10
       </a>
7 11
     </li>
8 12
   {% endfor %}
13
+  
14
+  {% if (tags|length)-1 > tags_display_limit %}
15
+    
16
+    <li>
17
+      <a class="display_all_cloud_tag" href="#" class="tag">
18
+        ...
19
+      </a>
20
+    </li>
21
+  {% endif %}
22
+    
9 23
 </ul>
10 24
 <div class="clearboth" ></div>

+ 10 - 1
src/Muzich/CoreBundle/Searcher/ElementSearcher.php View File

@@ -3,6 +3,7 @@
3 3
 namespace Muzich\CoreBundle\Searcher;
4 4
 
5 5
 use Doctrine\Bundle\DoctrineBundle\Registry;
6
+use Doctrine\ORM\NoResultException;
6 7
 
7 8
 class ElementSearcher extends Searcher implements SearcherInterface
8 9
 {
@@ -341,7 +342,15 @@ class ElementSearcher extends Searcher implements SearcherInterface
341 342
       break;
342 343
     
343 344
       case 'single':
344
-        return $query->getSingleResult();
345
+        try
346
+        {
347
+          return $query->getSingleResult();
348
+        } 
349
+        catch (NoResultException $exc)
350
+        {
351
+          return null;
352
+        }
353
+        
345 354
       break;
346 355
     
347 356
       default :

+ 29 - 26
src/Muzich/CoreBundle/Searcher/ElementSearcherQueryBuilder.php View File

@@ -247,37 +247,40 @@ class ElementSearcherQueryBuilder
247 247
             $tag_ids .= ','.(int)$tag_id;
248 248
           }
249 249
         }
250
-      
251
-        $sql = "SELECT et.element_id FROM elements_tag et "
252
-        ."WHERE et.tag_id IN ($tag_ids) group by et.element_id "
253
-        ."having count(distinct et.tag_id) = ".count($tags);
254
-        $rsm = new \Doctrine\ORM\Query\ResultSetMapping;
255
-        $rsm->addScalarResult('element_id', 'element_id');
250
+        
251
+        if (!is_null(trim($tag_ids)))
252
+        {
253
+          $sql = "SELECT et.element_id FROM elements_tag et "
254
+          ."WHERE et.tag_id IN ($tag_ids) group by et.element_id "
255
+          ."having count(distinct et.tag_id) = ".count($tags);
256
+          $rsm = new \Doctrine\ORM\Query\ResultSetMapping;
257
+          $rsm->addScalarResult('element_id', 'element_id');
256 258
 
257
-        $strict_element_ids_result = $this->em
258
-          ->createNativeQuery($sql, $rsm)
259
-          //->setParameter('ids', $tag_ids)
260
-          ->getScalarResult()
261
-        ;
259
+          $strict_element_ids_result = $this->em
260
+            ->createNativeQuery($sql, $rsm)
261
+            //->setParameter('ids', $tag_ids)
262
+            ->getScalarResult()
263
+          ;
262 264
 
263
-        $strict_element_ids = array();
264
-        if (count($strict_element_ids_result))
265
-        {
266
-          foreach ($strict_element_ids_result as $strict_id)
265
+          $strict_element_ids = array();
266
+          if (count($strict_element_ids_result))
267 267
           {
268
-            $strict_element_ids[] = $strict_id['element_id'];
268
+            foreach ($strict_element_ids_result as $strict_id)
269
+            {
270
+              $strict_element_ids[] = $strict_id['element_id'];
271
+            }
269 272
           }
270
-        }
271 273
 
272
-        if (count($strict_element_ids))
273
-        {
274
-          $this->query_ids->andWhere('e.id IN (:tag_strict_ids)');
275
-          $this->parameters_ids['tag_strict_ids'] = $strict_element_ids;
276
-        }
277
-        // Ce else palie au bug du au cas ou $strict_element_ids est egal a array();
278
-        else
279
-        {
280
-          return false;
274
+          if (count($strict_element_ids))
275
+          {
276
+            $this->query_ids->andWhere('e.id IN (:tag_strict_ids)');
277
+            $this->parameters_ids['tag_strict_ids'] = $strict_element_ids;
278
+          }
279
+          // Ce else palie au bug du au cas ou $strict_element_ids est egal a array();
280
+          else
281
+          {
282
+            return false;
283
+          }
281 284
         }
282 285
       }
283 286
     }

+ 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');

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

@@ -20,6 +20,14 @@ use Muzich\CoreBundle\Form\Playlist\PlaylistForm;
20 20
 class Controller extends BaseController
21 21
 {
22 22
   
23
+  const RESPONSE_STATUS_ID = 'status';
24
+  const RESPONSE_ERROR_ID = 'error';
25
+  const RESPONSE_MESSAGE_ID = 'message';
26
+  const RESPONSE_STATUS_ERROR = 'error';
27
+  
28
+  const ERROR_TYPE_NOTFOUND = 'notfound';
29
+  const ERROR_TYPE_MUSTBECONNECTED = 'mustbeconnected';
30
+  
23 31
   protected static $user = null;
24 32
   protected static $user_personal_query = null;
25 33
   protected static $tags = array();
@@ -517,7 +525,7 @@ class Controller extends BaseController
517 525
    */
518 526
   public function getEntityManager()
519 527
   {
520
-    return $this->getDoctrine()->getEntityManager();
528
+    return $this->getDoctrine()->getManager();
521 529
   }
522 530
   
523 531
   /**

+ 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)

+ 2 - 1
src/Muzich/PlaylistBundle/Resources/views/Show/user.html.twig View File

@@ -105,7 +105,8 @@
105 105
           
106 106
 
107 107
           {% include "MuzichCoreBundle:Tag:tag_cloud.html.twig" with {
108
-            'tags' : playlist.tags
108
+            'tags' : playlist.tags,
109
+            'tags_display_limit' : playlist_tags_count_displayed_max
109 110
           } %}
110 111
 
111 112
         </li>

+ 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'