|
@@ -117,27 +117,35 @@ class DefaultController extends Controller
|
117
|
117
|
try {
|
118
|
118
|
|
119
|
119
|
$group = $this->getDoctrine()
|
120
|
|
- ->getRepository('MuzichCoreBundle:Group')
|
121
|
|
- ->findOneBySlug($slug)
|
|
120
|
+ ->getEntityManager()->createQuery('SELECT g, t FROM MuzichCoreBundle:Group g
|
|
121
|
+ LEFT JOIN g.tags t WHERE g.slug = :gslug')
|
|
122
|
+ ->setParameter('gslug', $slug)
|
122
|
123
|
->getSingleResult()
|
123
|
124
|
;
|
124
|
125
|
|
125
|
126
|
} catch (\Doctrine\ORM\NoResultException $e) {
|
126
|
|
- throw $this->createNotFoundException('Groupe introuvable.');
|
|
127
|
+ return $this->createNotFoundException();
|
127
|
128
|
}
|
128
|
129
|
|
129
|
130
|
if ($group->getOwner()->getId() != $user->getId())
|
130
|
131
|
{
|
131
|
|
- throw $this->createNotFoundException('Vous n\'ête pas le créateur de ce groupe.');
|
|
132
|
+ return $this->createNotFoundException();
|
|
133
|
+ }
|
|
134
|
+
|
|
135
|
+ $prompt_tags = array();
|
|
136
|
+ foreach ($group->getTags() as $tag)
|
|
137
|
+ {
|
|
138
|
+ $prompt_tags[$tag->getTag()->getId()] = $tag->getTag()->getName();
|
132
|
139
|
}
|
133
|
140
|
|
134
|
141
|
$group->setTagsToIds();
|
135
|
142
|
$form = $this->getGroupForm($group);
|
136
|
143
|
|
137
|
144
|
return array(
|
138
|
|
- 'group' => $group,
|
139
|
|
- 'form' => $form->createView() ,
|
140
|
|
- 'form_name' => 'group'
|
|
145
|
+ 'group' => $group,
|
|
146
|
+ 'form' => $form->createView(),
|
|
147
|
+ 'form_name' => 'group',
|
|
148
|
+ 'search_tags' => $prompt_tags
|
141
|
149
|
);
|
142
|
150
|
}
|
143
|
151
|
|