|
@@ 156-178 (lines=23) @@
|
| 153 |
|
* @param Request $request |
| 154 |
|
* @return Response |
| 155 |
|
*/ |
| 156 |
|
public function licenseeSuggestAction(Request $request): Response |
| 157 |
|
{ |
| 158 |
|
$filter = $request->query->get('filter'); |
| 159 |
|
|
| 160 |
|
$searchString = $filter['value']; |
| 161 |
|
|
| 162 |
|
$mongo = $this->get('doctrine_mongodb'); |
| 163 |
|
/* @var $repository \Doctrine\ODM\MongoDB\DocumentRepository */ |
| 164 |
|
$repository = $mongo->getRepository('DembeloMain:Licensee'); |
| 165 |
|
|
| 166 |
|
$licensees = $repository->findBy(array('name' => new \MongoRegex('/'.$searchString.'/')), null, 10); |
| 167 |
|
|
| 168 |
|
$output = array(); |
| 169 |
|
/* @var $licensee \DembeloMain\Document\Licensee */ |
| 170 |
|
foreach ($licensees as $licensee) { |
| 171 |
|
$output[] = array( |
| 172 |
|
'id' => $licensee->getId(), |
| 173 |
|
'value' => $licensee->getName(), |
| 174 |
|
); |
| 175 |
|
} |
| 176 |
|
|
| 177 |
|
return new Response(\json_encode($output)); |
| 178 |
|
} |
| 179 |
|
|
| 180 |
|
/** |
| 181 |
|
* @Route("/topicSuggest", name="admin_topic_suggest") |
|
@@ 186-208 (lines=23) @@
|
| 183 |
|
* @param Request $request |
| 184 |
|
* @return Response |
| 185 |
|
*/ |
| 186 |
|
public function topicSuggestAction(Request $request): Response |
| 187 |
|
{ |
| 188 |
|
$filter = $request->query->get('filter'); |
| 189 |
|
|
| 190 |
|
$searchString = $filter['value']; |
| 191 |
|
|
| 192 |
|
$mongo = $this->get('doctrine_mongodb'); |
| 193 |
|
/* @var $repository \Doctrine\ODM\MongoDB\DocumentRepository */ |
| 194 |
|
$repository = $mongo->getRepository('DembeloMain:Topic'); |
| 195 |
|
|
| 196 |
|
/* @var $topics \DembeloMain\Document\Topic[] */ |
| 197 |
|
$topics = $repository->findBy(array('name' => new \MongoRegex('/'.$searchString.'/')), null, 10); |
| 198 |
|
|
| 199 |
|
$output = []; |
| 200 |
|
foreach ($topics as $topic) { |
| 201 |
|
$output[] = array( |
| 202 |
|
'id' => $topic->getId(), |
| 203 |
|
'value' => $topic->getName(), |
| 204 |
|
); |
| 205 |
|
} |
| 206 |
|
|
| 207 |
|
return new Response(\json_encode($output)); |
| 208 |
|
} |
| 209 |
|
|
| 210 |
|
/** |
| 211 |
|
* @Route("/topics", name="admin_topics") |