Skip to content

Commit d037a05

Browse files
feat(article): Get whole article
1 parent b6b2e63 commit d037a05

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/SWP/Bundle/ContentBundle/Controller/ArticleController.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,8 @@ public function getAction($id): SingleResourceResponseInterface {
123123
public function getByCodeAction(Request $request): SingleResourceResponseInterface {
124124
// Extract parameters from the request
125125
$code = $request->query->get('code', '');
126-
127-
$article = $this->entityManager->createQuery('SELECT a.id FROM SWP\Bundle\ContentBundle\Model\Article a where a.code = :code')
128-
->setParameter('code', $code)
129-
//->setParameter('tenant_code', $tenantCode)
130-
->setMaxResults(1)
131-
->getOneOrNullResult();
126+
$article = $this->entityManager->getRepository('SWP\Bundle\ContentBundle\Model\Article')
127+
->findOneBy(['code' => $code]);
132128

133129
if (null === $article) {
134130
throw new NotFoundHttpException('Article was not found');

0 commit comments

Comments
 (0)