| @@ 80-98 (lines=19) @@ | ||
| 77 | * @throws \UnexpectedValueException |
|
| 78 | * @throws \InvalidArgumentException |
|
| 79 | */ |
|
| 80 | public function licenseeSuggestAction(Request $request): Response |
|
| 81 | { |
|
| 82 | $filter = $request->query->get('filter'); |
|
| 83 | ||
| 84 | $searchString = $filter['value']; |
|
| 85 | ||
| 86 | /* @var $licensees Licensee[] */ |
|
| 87 | $licensees = $this->licenseeRepository->findBy(['name' => new \MongoRegex('/'.$searchString.'/')], null, 10); |
|
| 88 | ||
| 89 | $output = []; |
|
| 90 | foreach ($licensees as $licensee) { |
|
| 91 | $output[] = array( |
|
| 92 | 'id' => $licensee->getId(), |
|
| 93 | 'value' => $licensee->getName(), |
|
| 94 | ); |
|
| 95 | } |
|
| 96 | ||
| 97 | return new Response(\json_encode($output)); |
|
| 98 | } |
|
| 99 | } |
|
| 100 | ||
| @@ 93-111 (lines=19) @@ | ||
| 90 | * @return Response |
|
| 91 | * @throws \InvalidArgumentException |
|
| 92 | */ |
|
| 93 | public function topicSuggestAction(Request $request): Response |
|
| 94 | { |
|
| 95 | $filter = $request->query->get('filter'); |
|
| 96 | ||
| 97 | $searchString = $filter['value']; |
|
| 98 | ||
| 99 | /* @var $topics \DembeloMain\Document\Topic[] */ |
|
| 100 | $topics = $this->topicRepository->findBy(array('name' => new \MongoRegex('/'.$searchString.'/')), null, 10); |
|
| 101 | ||
| 102 | $output = []; |
|
| 103 | foreach ($topics as $topic) { |
|
| 104 | $output[] = array( |
|
| 105 | 'id' => $topic->getId(), |
|
| 106 | 'value' => $topic->getName(), |
|
| 107 | ); |
|
| 108 | } |
|
| 109 | ||
| 110 | return new Response(\json_encode($output)); |
|
| 111 | } |
|
| 112 | ||
| 113 | /** |
|
| 114 | * @Route("/topic/uploadimage", name="admin_topics_image") |
|