{"id":413,"date":"2020-07-07T16:44:00","date_gmt":"2020-07-07T08:44:00","guid":{"rendered":"https:\/\/heoffice.com\/?p=413"},"modified":"2020-07-07T16:47:37","modified_gmt":"2020-07-07T08:47:37","slug":"fos-restbundle-%e5%8d%87%e7%ba%a7%e5%87%ba%e9%94%99","status":"publish","type":"post","link":"https:\/\/heoffice.com\/?p=413","title":{"rendered":"FOS\/RestBundle \u5347\u7ea7\u51fa\u9519."},"content":{"rendered":"\n<p>FOS\/RestBundle \u5347\u7ea7\u540e\u62a5\u9519\u5982\u4e0b:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\"message\": \"Service \\\"App\\\\Service\\\\MySpeechService\\\" not found: even though it exists in the app's container, the container inside \\\"App\\\\Controller\\\\MySpeechController\\\" is a smaller service locator that only knows about the \\\"doctrine\\\", \\\"form.factory\\\", \\\"fos_rest.view_handler\\\", \\\"http_kernel\\\", \\\"parameter_bag\\\", \\\"request_stack\\\", \\\"router\\\", \\\"security.authorization_checker\\\", \\\"security.csrf.token_manager\\\", \\\"security.token_storage\\\", \\\"serializer\\\", \\\"session\\\", \\\"templating\\\" and \\\"twig\\\" services. Try using dependency injection instead.\",<\/code><\/pre>\n\n\n\n<p>\u5c06\u5728\/config\/service.yml\u4e2d\u7684<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>    App\\Controller\\:\n        resource: '..\/src\/Controller'\n        tags: &#91;'controller.service_arguments'] <\/code><\/pre>\n\n\n\n<p>\u4fee\u6539\u4e3a:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>    App\\Controller\\:\n        resource: '..\/src\/Controller'\n        tags: &#91;'controller.service_arguments'] \n        calls:\n             - &#91;setContainer, &#91;\"@service_container\"]]<\/code><\/pre>\n\n\n\n<p>\u5373\u53ef<\/p>\n","protected":false},"excerpt":{"rendered":"<p>FOS\/RestBundle \u5347\u7ea7\u540e\u62a5\u9519\u5982\u4e0b: \u5c06\u5728\/config\/service.yml\u4e2d\u7684 \u4fee\u6539\u4e3a: \u5373\u53ef<\/p>\n","protected":false},"author":1,"featured_media":416,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[3,7],"tags":[],"class_list":["post-413","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php","category-symfony"],"acf":[],"_links":{"self":[{"href":"https:\/\/heoffice.com\/index.php?rest_route=\/wp\/v2\/posts\/413","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/heoffice.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/heoffice.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/heoffice.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/heoffice.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=413"}],"version-history":[{"count":1,"href":"https:\/\/heoffice.com\/index.php?rest_route=\/wp\/v2\/posts\/413\/revisions"}],"predecessor-version":[{"id":414,"href":"https:\/\/heoffice.com\/index.php?rest_route=\/wp\/v2\/posts\/413\/revisions\/414"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/heoffice.com\/index.php?rest_route=\/wp\/v2\/media\/416"}],"wp:attachment":[{"href":"https:\/\/heoffice.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=413"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/heoffice.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=413"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/heoffice.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=413"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}