@anboo

Unable to find template FOSUserBundle?

routing:
backend_users_api:
  type: rest
  resource: "@BackendUserBundle/Controller/Api/UserController.php"
  prefix: /


config:
sensio_framework_extra:
    view:
        annotations: false
    router:
        annotations: true

fos_rest:
  format_listener:
      rules:
          - prefer_extension: false
  routing_loader:
      default_format: json
      include_format: false
  view:
      view_response_listener: force


Controller:
/**
 * Class UserController
 * @package Backend\UserBundle\Controller\Api
 * @Route("/api")
 */
class UserController extends FOSRestController
{
    /**
     * @var EntityManager
     * @DI\Inject("doctrine.orm.entity_manager")
     */
    public $em;

    /**
     * @Rest\Route("/all")
     * @Rest\View()
     */
    public function allAction()
    {
        $users = $this->em->getRepository('AppBundle:User')->findAll();

        return array('users' => $users);
    }


При запросе на /api/data выдает 500 и ошибку: FOSUserBundle:Api\User:all.html.twig
  • Вопрос задан
  • 234 просмотра
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы