Symfony2와 FOSRestBundle을 사용하여 REST 프레임 워크를 만들려고 노력 중이며 비참하게 실패하고 있습니다.FOSRestBundle을 사용할 수 없습니다.
나는 다음과 같은 짓을 :
namespace Rest\WebServiceBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use FOS\RestBundle\View\View;
class DefaultController extends Controller
{
public function indexAction($name)
{
$view = View::create()
->setStatusCode(200)
->setData($name);
return $this->get('fos_rest.view_handler')->handle($view);
}
}
: 내 컨트롤러에서 내 응용 프로그램에서
[FOSRest]
git=git://github.com/FriendsOfSymfony/FOSRest.git
target=fos/FOS/Rest
[FOSRestBundle]
git=git://github.com/FriendsOfSymfony/FOSRestBundle.git
target=bundles/FOS/RestBundle
[JMSSerializerBundle]
git=git://github.com/schmittjoh/JMSSerializerBundle.git
target=bundles/JMS/SerializerBundle
/config.yml
fos_rest:
view:
formats:
rss: true
xml: false
templating_formats:
html: true
force_redirects:
html: true
failed_validation: HTTP_BAD_REQUEST
default_engine: twig
sensio_framework_extra:
view:
annotations: false
: 내 deps 파일에
을
URL : 012로 이동하면
내가 얻을 :
Unable to find template "".
500 Internal Server Error - InvalidArgumentException
2 linked Exceptions: Twig_Error_Loader » Twig_Error_Loader
문서는 나에게 혼란 보인다 나는 계속할 수 없습니다입니다. 필자가 원하는 것은 컨트롤러에 데이터 배열을 전달하고 JSON 형식을 돌려받을 수 있어야한다는 것입니다. 누군가 도울 수 있습니까?
이 문제가 발생하는 데 문제가 있습니다. 비교적 간단한 작업처럼 보이는 것은 꽤 혼란스러워 보입니다. 그걸 가지고 행운이 있었나요? – greg