我和Symfony2 Doctrine Unrecognized field:有类似的问题但是我没有相同的解决方案
我有一个实体“类别”我试图找到属性“activo”设置为true的所有类别,但它给了我标题中的错误
我已经完成了php app / console doctrine:generate:entities [path] - no-backup和php app / console doctrine:schema:update --force
我的数据库中的表更新为我的实体。
<?php
namespace ROSHKA\BBVA\SitioExperience\FrontendBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Expcategorias
*/
class Expcategorias
{
/**
* @var integer
*/
private $id;
/**
* @var string
*/
private $nombre;
/**
* @var string
*/
private $descripcion;
/**
* @var \ROSHKA\BBVA\SitioUniversos\ImagenesBundle\Entity\Imagenes
*/
private $imagen;
/**
* @var string
*/
private $titulo;
/**
* @var boolean
*/
private $activo;
/**
* @var string
*/
private $colorfondo;
/**
* @var \ROSHKA\BBVA\SitioUniversos\ImagenesBundle\Entity\Imagenes
*/
private $imagenfondo;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set nombre
*
* @param string $nombre
* @return Expcategorias
*/
public function setNombre($nombre)
{
$this->nombre = $nombre;
return $this;
}
/**
* Get nombre
*
* @return string
*/
public function getNombre()
{
return $this->nombre;
}
/**
* Set descripcion
*
* @param string $descripcion
* @return Expcategorias
*/
public function setDescripcion($descripcion)
{
$this->descripcion = $descripcion;
return $this;
}
/**
* Get descripcion
*
* @return string
*/
public function getDescripcion()
{
return $this->descripcion;
}
/**
* Set imagen
*
* @param \ROSHKA\BBVA\SitioUniversos\ImagenesBundle\Entity\Imagenes $imagen
* @return Expcategorias
*/
public function setImagen(\ROSHKA\BBVA\SitioUniversos\ImagenesBundle\Entity\Imagenes $imagen = null)
{
$this->imagen = $imagen;
return $this;
}
/**
* Get imagen
*
* @return \ROSHKA\BBVA\SitioUniversos\ImagenesBundle\Entity\Imagenes
*/
public function getImagen()
{
return $this->imagen;
}
public function __toString()
{
return $this->getNombre();
}
/**
* Set titulo
*
* @param string $titulo
* @return Expcategorias
*/
public function setTitulo($titulo)
{
$this->titulo = $titulo;
return $this;
}
/**
* Get titulo
*
* @return string
*/
public function getTitulo()
{
return $this->titulo;
}
/**
* Set activo
*
* @param boolean $activo
* @return Expcategorias
*/
public function setActivo($activo)
{
$this->activo = $activo;
return $this;
}
/**
* Get activo
*
* @return boolean
*/
public function getActivo()
{
return $this->activo;
}
/**
* Set colorfondo
*
* @param string $colorfondo
* @return Expcategorias
*/
public function setColorfondo($colorfondo)
{
$this->colorfondo = $colorfondo;
return $this;
}
/**
* Get colorfondo
*
* @return string
*/
public function getColorfondo()
{
return $this->colorfondo;
}
/**
* Set imagenfondo
*
* @param \ROSHKA\BBVA\SitioUniversos\ImagenesBundle\Entity\Imagenes $imagenfondo
* @return Expcategorias
*/
public function setImagenfondo(\ROSHKA\BBVA\SitioUniversos\ImagenesBundle\Entity\Imagenes $imagenfondo = null)
{
$this->imagenfondo = $imagenfondo;
return $this;
}
/**
* Get imagenfondo
*
* @return \ROSHKA\BBVA\SitioUniversos\ImagenesBundle\Entity\Imagenes
*/
public function getImagenfondo()
{
return $this->imagenfondo;
}
}
这就是我用来在控制器中调用它的方法。当我在这里调试并设置断点时,我可以在表达式部分看到我的类别只有三列而不是应该有的9列。我不知道还能做什么。
$repo = $this->getDoctrine()->getRepository('ROSHKABBVASitioExperienceFrontendBundle:Expcategorias');
$categorias = $repo->findBy(array('activo'=>true));
经过一段时间的思考,我记得我已经安装了memcached,然后我所做的就是在任务管理器中重新启动memcached,然后我的项目获取了所有新值。