public function getArticleTypeAction(Request $request, $name) { $em = $this->container->get('em'); $type = $em->getRepository('Newscoop\\Entity\\ArticleType')->findOneByName($name); if (!$type) { throw new NotFoundHttpException('Article Type was not found'); } $articleTypesFields = $em->getRepository('Newscoop\\Entity\\ArticleTypeField')->getFieldsForType($type)->getResult(); $allItems = array('name' => $type->getName(), 'fields' => $articleTypesFields); return $allItems; }