我收到此错误
第 2 行的 DprocMainBundle:Dproc:single.html.twig 中不存在键为“0”的数组的键“getPageTitle”
第 2 行:{{ page.getPageTitle }}
我的实体文件
<?php
namespace Dproc\MainBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @IgnoreAnnotation("fn")
*
*/
/**
* @ORM\Entity
* @ORM\Table(name="pages")
*/
class Pages
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $Id;
/**
* @ORM\Column(name="page_title", type="text")
*/
protected $pageTitle;
/**
* @ORM\Column(name="page_content", type="text")
*/
protected $pageContent;
/**
* @ORM\Column(name="page_category", type="text")
*/
protected $pageCategory;
/**
* Get Id
*
* @return integer
*/
public function getId()
{
return $this->Id;
}
/**
* Set page_title
*
* @param string $pageTitle
* @return Pages
*/
public function setPageTitle($pageTitle)
{
$this->pageTitle = $pageTitle;
return $this;
}
/**
* Get page_title
*
* @return string
*/
public function getPageTitle()
{
return $this->pageTitle;
}
/**
* Set page_content
*
* @param string $pageContent
* @return Pages
*/
public function setPageContent($pageContent)
{
$this->pageContent = $pageContent;
return $this;
}
/**
* Get page_content
*
* @return string
*/
public function getPageContent()
{
return $this->pageContent;
}
/**
* Set page_category
*
* @param string $pageCategory
* @return Pages
*/
public function setPageCategory($pageCategory)
{
$this->pageCategory = $pageCategory;
return $this;
}
/**
* Get page_category
*
* @return string
*/
public function getPageCategory()
{
return $this->pageCategory;
}
}
控制器
public function IndexAction($slug)
{
$page = $this->getDoctrine()
->getRepository('DprocMainBundle:Pages')
->findByPageTitle($slug);
if (!$page) {
throw $this->createNotFoundException('No product found for slug '.$slug);
}
//print_r($page);
return $this->render('DprocMainBundle:Dproc:single.html.twig',array('page' => $page));
}
我做错了什么,我应该如何调用我的getter方法getPageTitle?
谢谢