的Symfony对ParamConverter手册里有这个例子:Symfony2 - 如何在控制器中使用@Entity标注?
/**
* @Route("/blog/{post_id}")
* @Entity("post", expr="repository.find(post_id)")
*/
public function showAction(Post $post)
{
}
但使用@Entity标注给了我这个错误。
The annotation "@Entity" in method AppBundle\Controller\CurrencyController::currencyAction() was never imported. Did you maybe forget to add a "use" statement for this annotation?
显然,我需要使用一个命名空间,但哪一个?请帮忙。
你需要做什么错误消息说 - 导入实体。您忘记在脚本的顶部添加“使用”语句。 –
对,但是究竟是哪一个?这是个问题。 SensioFrameworkExtraBundle没有@Entity注释(至少不在Symfony2中),但手册建议使用它。 –