Symfony 2 尝试从命名空间加载类" " " " 您是否忘记了另一个命名空间的"use"语句?



我正在尝试在Symfony控制器中使用实体Philip

。但是这个错误在我想加载路由时显示:

错误屏幕截图

试图从命名空间加载类"PhilipRepositroy" "AppBundle\Repository " 您是否忘记了另一个的"use"语句 命名空间?

我的控制器

/**
* @Route("/see", name="see")
*/
public function SeeAction()
{
$Philip = $this->getDoctrine()
->getRepository('AppBundle:Philip')
->findAll();
return $this->render('business/see.html.twig', array(
'Philip' => $Philip
));
}

我的菲利普实体

<?php
namespace AppBundleEntity;
use DoctrineORMMapping 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;
}
}

我的菲利普存储库

<?php
namespace AppBundleRepository;
use DoctrineORMEntityRepository;
/**
* PhilipRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class PhilipRepository extends EntityRepository
{
}

我能做些什么来解决这个问题?我是Symfony的新手

所以我猜你没能得到存储库类?然后在Philip实体类中添加映射

use DoctrineORMMapping as ORM;
/**
* @ORMEntity(repositoryClass="AppBundleRepositoryPhilipRepository")
*/
class Philip
{
...
}

相关内容

  • 没有找到相关文章

最新更新