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
   
9
   
10
   sentence_filter_link_string: delete them.
10
   sentence_filter_link_string: delete them.
11
   
11
   
12
+  nofound_anymore:      Share not found (maybe deleted by owner)
13
+  
12
 element:
14
 element:
13
   favorite:
15
   favorite:
14
     add:                Add to faves
16
     add:                Add to faves

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

8
                          <br />Vous pouvez ajouter des tags ou
8
                          <br />Vous pouvez ajouter des tags ou
9
                          <a class="filter_clear_url" href="#" >%link_string%</a>.
9
                          <a class="filter_clear_url" href="#" >%link_string%</a>.
10
   sentence_filter_link_string: les retirer
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
 element:
13
 element:
13
   favorite:
14
   favorite:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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
   protected function getSelectElementForSearchQuery($params_select, $user_id, $ids, $id_limit = null, $count_limit = null, $ids_display = null)
384
   protected function getSelectElementForSearchQuery($params_select, $user_id, $ids, $id_limit = null, $count_limit = null, $ids_display = null)
385
   {
385
   {
518
     $doctrineConfig = $this->getEntityManager()->getConfiguration();
518
     $doctrineConfig = $this->getEntityManager()->getConfiguration();
519
     $doctrineConfig->addCustomStringFunction('FIELD', 'Muzich\CoreBundle\DoctrineExtensions\Query\Mysql\Field');
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
     return $this->getEntityManager()->createQueryBuilder()
532
     return $this->getEntityManager()->createQueryBuilder()
522
-      ->select('e, field(e.id, ' . implode(', ', $element_ids) . ') as HIDDEN field')
533
+      ->select('e')
523
       ->from('MuzichCoreBundle:Element', 'e')
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
     $(this).hide();
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
   $('input#cloud_tags_filter').keyup(function(){
2577
   $('input#cloud_tags_filter').keyup(function(){
2572
     var search_string = $(this).val();
2578
     var search_string = $(this).val();
2573
     
2579
     
3141
           function(){}
3147
           function(){}
3142
         );
3148
         );
3143
 
3149
 
3150
+        line.find('img.loader').hide();
3144
         if (response.status === 'success')
3151
         if (response.status === 'success')
3145
         {
3152
         {
3146
           line.find('div.content_opened').html('<ul class="elements">' + response.data + '</ul>');
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
     else
3162
     else

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

1
+{% if tags_display_limit is not defined %}
2
+  {% set tags_display_limit = cloud_tags_limit_to_display %}
3
+{% endif %}
4
+
1
 <ul class="tags_cloud">
5
 <ul class="tags_cloud">
2
   {% for key, tag in tags %}
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
       <a data-tagid="{{ tag.id }}" href="#" class="tag">
8
       <a data-tagid="{{ tag.id }}" href="#" class="tag">
5
         {{ tag.name }}
9
         {{ tag.name }}
6
       </a>
10
       </a>
7
     </li>
11
     </li>
8
   {% endfor %}
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
 </ul>
23
 </ul>
10
 <div class="clearboth" ></div>
24
 <div class="clearboth" ></div>

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

3
 namespace Muzich\CoreBundle\Searcher;
3
 namespace Muzich\CoreBundle\Searcher;
4
 
4
 
5
 use Doctrine\Bundle\DoctrineBundle\Registry;
5
 use Doctrine\Bundle\DoctrineBundle\Registry;
6
+use Doctrine\ORM\NoResultException;
6
 
7
 
7
 class ElementSearcher extends Searcher implements SearcherInterface
8
 class ElementSearcher extends Searcher implements SearcherInterface
8
 {
9
 {
341
       break;
342
       break;
342
     
343
     
343
       case 'single':
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
       break;
354
       break;
346
     
355
     
347
       default :
356
       default :

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

20
 class Controller extends BaseController
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
   protected static $user = null;
31
   protected static $user = null;
24
   protected static $user_personal_query = null;
32
   protected static $user_personal_query = null;
25
   protected static $tags = array();
33
   protected static $tags = array();
517
    */
525
    */
518
   public function getEntityManager()
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
    */
271
    */
272
   protected function findUserByUsername($username)
272
   protected function findUserByUsername($username)
273
   {
273
   {
274
-    return $this->getDoctrine()->getEntityManager()->getRepository('MuzichCoreBundle:User')
274
+    return $this->getDoctrine()->getManager()->getRepository('MuzichCoreBundle:User')
275
       ->findOneByUsername($username)
275
       ->findOneByUsername($username)
276
     ;
276
     ;
277
   }
277
   }
530
    */
530
    */
531
   protected function getEntityManager()
531
   protected function getEntityManager()
532
   {
532
   {
533
-    return $this->getDoctrine()->getEntityManager();
533
+    return $this->getDoctrine()->getManager();
534
   }
534
   }
535
   
535
   
536
   /**
536
   /**

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

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

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

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

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

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

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

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

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

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

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

105
           
105
           
106
 
106
 
107
           {% include "MuzichCoreBundle:Tag:tag_cloud.html.twig" with {
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
         </li>
112
         </li>

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

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