我需要从Symfony 3中的path参数中获取两个实体对象。从document中,我可以这样做:
/**
* @Route("/blog/{id}/comments/{comment_id}")
* @Entity("comment", expr="repository.find(comment_id)")
*/
public function showAction(Post $post, Comment $comment)
{
}
但是,我找不到这个@Entity
的来源。页面返回时出现错误:
[Semantical Error] The annotation "@Entity" in method ABCBundle\Controller\ABCController::editAction() was never imported. Did you maybe forget to add a "use" statement for this annotation? in /srv/www/symfony3/src/ABCBundleController (which is being imported from "/srv/www/symfony3/src/ABCBundle/Resources/config/routing.yml").
有人知道吗?
发布于 2016-12-09 16:09:57
您可能需要添加以下use
语句:
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Entity;
https://stackoverflow.com/questions/41053205
复制相似问题