也许我只是缺少它,我想隐藏控制器的休息方法,没有实现他们类似的选项,删除,头招摇的UI你怎么隐藏其他方法无法实现的
是否有标注为这个?文档 使用https://github.com/nelmio/NelmioApiDocBundle V3
目前,当我查看/ API/DOC任何控制器我添加列表中的所有其他方法,即使我只有实现了一个GET方法,我找不到它。
<?php
namespace ApiBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\JsonResponse;
use Swagger\Annotations as SWG;
class UserController extends Controller
{
/**
* @Security("is_granted('IS_AUTHENTICATED_FULLY')")
* @Route("/api/users", name="get_users", methods={"GET"})
*
* @SWG\Response(
* response=200,
* description="Returns all users"
*)
* @SWG\Tag(name="users")
*
*
* @return \Symfony\Component\HttpFoundation\JsonResponse
*/
public function getUsersAction()
{
$repo = $this->getDoctrine()
->getRepository('AccountBundle:User');
$users = $repo->createQueryBuilder('q')
->getQuery()
->getArrayResult();
return new JsonResponse($users);
}
}
嗯,你设置了接口的原因是遵循和实施所有的方法。如果你的类正在实现一个接口并且没有实现所有的方法,你只是做错了。创建一个简单的界面,不用那些未使用的签名,并让你的类实现它。 –
这个班级没有实现一个接口 – user1930591
你可以发布你所有的班级代码吗? –