我的控制器中有这个代码:
namespace BankBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use BankBundle\Entity\Account;
use BankBundle\Entity\AccountType;
use BankBundle\Form\AccountType;
也有这种方法:
/**
* Show created bank account
*
* @Route("/account/show/{account_id}", name="wba_show")
* @Method("GET")
*/
public function showBAAction($account_id) {
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('BankBundle:Account')->find($account_id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Account entity.');
}
$deleteForm = $this->createDeleteForm($account_id);
return array('entity' => $entity, 'delete_form' => $deleteForm->createView());
}
当我调用网址/account/show/1
时,我直接得到了例外,为什么?我想念一些东西吗?