简体   繁体   中英

Symfony2.3 Unrecognized field ORMexception

I'm having a similiar issue to Symfony2 Doctrine Unrecognized field: But mine doesn't have the same solution

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

I've done php app/console doctrine:generate:entities [path] --no-backup and php app/console doctrine: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. I don't know what else to do.

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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