我正在尝试在Symfony控制器中使用Entity Philip
但是这个错误显示我想加载路线的时间:
尝试从命名空间加载类“PhilipRepositroy” “AppBundle \ Repository”您是否忘记了另一个“使用”声明 命名空间?
我的控制器
uintptr_t
我的菲利普实体
/**
* @Route("/see", name="see")
*/
public function SeeAction()
{
$Philip = $this->getDoctrine()
->getRepository('AppBundle:Philip')
->findAll();
return $this->render('business/see.html.twig', array(
'Philip' => $Philip
));
}
我的PhilipRepository
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Philip
*/
class Philip
{
/**
* @var int
*/
private $id;
/**
* @var string
*/
private $philipname;
/**
* @var string
*/
private $philipemail;
/**
* @var string
*/
private $philipphone;
/**
* @var string
*/
private $philipregion;
/**
* @var string
*/
private $philipville;
/**
* @var string
*/
private $philipcin;
/**
* @var string
*/
private $philipcv;
/**
* @var string
*/
private $philipgender;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set philipname
*
* @param string $philipname
* @return Philip
*/
public function setPhilipname($philipname)
{
$this->philipname = $philipname;
return $this;
}
/**
* Get philipname
*
* @return string
*/
public function getPhilipname()
{
return $this->philipname;
}
/**
* Set philipemail
*
* @param string $philipemail
* @return Philip
*/
public function setPhilipemail($philipemail)
{
$this->philipemail = $philipemail;
return $this;
}
/**
* Get philipemail
*
* @return string
*/
public function getPhilipemail()
{
return $this->philipemail;
}
/**
* Set philipphone
*
* @param string $philipphone
* @return Philip
*/
public function setPhilipphone($philipphone)
{
$this->philipphone = $philipphone;
return $this;
}
/**
* Get philipphone
*
* @return string
*/
public function getPhilipphone()
{
return $this->philipphone;
}
/**
* Set philipregion
*
* @param string $philipregion
* @return Philip
*/
public function setPhilipregion($philipregion)
{
$this->philipregion = $philipregion;
return $this;
}
/**
* Get philipregion
*
* @return string
*/
public function getPhilipregion()
{
return $this->philipregion;
}
/**
* Set philipville
*
* @param string $philipville
* @return Philip
*/
public function setPhilipville($philipville)
{
$this->philipville = $philipville;
return $this;
}
/**
* Get philipville
*
* @return string
*/
public function getPhilipville()
{
return $this->philipville;
}
/**
* Set philipcin
*
* @param string $philipcin
* @return Philip
*/
public function setPhilipcin($philipcin)
{
$this->philipcin = $philipcin;
return $this;
}
/**
* Get philipcin
*
* @return string
*/
public function getPhilipcin()
{
return $this->philipcin;
}
/**
* Set philipcv
*
* @param string $philipcv
* @return Philip
*/
public function setPhilipcv($philipcv)
{
$this->philipcv = $philipcv;
return $this;
}
/**
* Get philipcv
*
* @return string
*/
public function getPhilipcv()
{
return $this->philipcv;
}
/**
* Set philipgender
*
* @param string $philipgender
* @return Philip
*/
public function setPhilipgender($philipgender)
{
$this->philipgender = $philipgender;
return $this;
}
/**
* Get philipgender
*
* @return string
*/
public function getPhilipgender()
{
return $this->philipgender;
}
}
我可以做些什么来解决这个问题?我是Symfony的新手
答案 0 :(得分:1)
所以我猜你没能得到Repository类?然后在Philip
实体类中添加映射
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="AppBundle\Repository\PhilipRepository")
*/
class Philip
{
...
}