简体   繁体   English

Symfony2.3无法识别的字段ORMexception

[英]Symfony2.3 Unrecognized field ORMexception

I'm having a similiar issue to Symfony2 Doctrine Unrecognized field: But mine doesn't have the same solution 我对Symfony2学说无法识别的领域有一个类似的问题但是我的解决方案不一样

I have an entity "category" I'm trying to find all the categories with the attribute "activo" set to true but it gives me the error in the title 我有一个实体“ category”,我正在尝试查找所有将“ activo”属性设置为true的类别,但这给我标题中的错误

I've done php app/console doctrine:generate:entities [path] --no-backup and php app/console doctrine:schema:update --force 我已经完成了php应用程序/控制台学说:generate:entities [path] --no-backup和php应用程序/控制台学说:schema:update --force

My table in my database is updated just as my entity. 数据库中的表与实体一样被更新。

<?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;
}

} }

This is what I use to call it in my controller. 这就是我在控制器中使用的名称。 When I debug and set a breakpoint here i can see in the expressions sections that my category only has three columns instead of the 9 columns that should have. 当我在此处调试和设置断点时,我可以在表达式部分中看到我的类别只有三列,而不是应该有的9列。 I don't know what else to do. 我不知道该怎么办

$repo = $this->getDoctrine()->getRepository('ROSHKABBVASitioExperienceFrontendBundle:Expcategorias');
        $categorias = $repo->findBy(array('activo'=>true));  

想了一会后,我想起我已经安装了memcached,然后我所做的就是在任务管理器中重新启动memcached,然后我的项目采用了所有新值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM