I’m getting this error on my production environnent: (from prod.log)
[2012-01-30 17:00:51] request.CRITICAL: Doctrine\ORM\Mapping\MappingException: Class Gitek\UdaBundle\Entity\Curso is not a valid entity or mapped super class. (uncaught exception) at /home/uda/shared/vendor/doctrine/lib/Doctrine/ORM/Mapping/MappingException.php line 142 [] []
But in my development environnent everything works fine.
And this is my Curso entity:
<?php
namespace Gitek\UdaBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* Gitek\UdaBundle\Entity\Curso
*
* @ORM\Table(name="Curso")
* @ORM\HasLifecycleCallbacks
* @ORM\Entity(repositoryClass="Gitek\UdaBundle\Entity\CursoRepository")
*/
class Curso
{
/**
* @var integer $id
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string $nombre
*
* @ORM\Column(name="nombre", type="string", length=255)
*/
private $nombre;
/**
* @var string $version
*
* @ORM\Column(name="version", type="string", length=255, nullable=true)
*/
private $version;
/**
* @var integer $orden
*
* @ORM\Column(name="orden", type="integer", nullable=true, nullable=true)
*/
private $orden;
/**
* @var integer $tiempo
*
* @ORM\Column(name="tiempo", type="integer", nullable=true, nullable=true)
*/
private $tiempo;
/**
* @ORM\OneToMany(targetEntity="Detcurso", mappedBy="curso", cascade={"remove"})
* @ORM\OrderBy({"orden" = "ASC"})
*/
private $detcursos;
/**
* @ORM\OneToMany(targetEntity="Historial", mappedBy="curso", cascade={"remove"})
*/
private $historiales;
/**
* @ORM\Column(type="datetime")
*/
protected $created;
/**
* @ORM\Column(type="datetime")
*/
protected $updated;
public function __construct()
{
$this->detcursos = new \Doctrine\Common\Collections\ArrayCollection();
$this->setCreated(new \DateTime());
$this->setUpdated(new \DateTime());
}
public function __toString()
{
return $this->getNombre();
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set nombre
*
* @param string $nombre
*/
public function setNombre($nombre)
{
$this->nombre = $nombre;
}
/**
* Get nombre
*
* @return string
*/
public function getNombre()
{
return $this->nombre;
}
/**
* Set version
*
* @param string $version
*/
public function setVersion($version)
{
$this->version = $version;
}
/**
* Get version
*
* @return string
*/
public function getVersion()
{
return $this->version;
}
/**
* Set orden
*
* @param integer $orden
*/
public function setOrden($orden)
{
$this->orden = $orden;
}
/**
* Get orden
*
* @return integer
*/
public function getOrden()
{
return $this->orden;
}
/**
* Set created
*
* @param datetime $created
*/
public function setCreated($created)
{
$this->created = $created;
}
/**
* Get created
*
* @return datetime
*/
public function getCreated()
{
return $this->created;
}
/**
* Set updated
*
* @param datetime $updated
*/
public function setUpdated($updated)
{
$this->updated = $updated;
}
/**
* Get updated
*
* @return datetime
*/
public function getUpdated()
{
return $this->updated;
}
/**
* Add detcursos
*
* @param Gitek\UdaBundle\Entity\Detcurso $detcursos
*/
public function addDetcurso(\Gitek\UdaBundle\Entity\Detcurso $detcursos)
{
$this->detcursos[] = $detcursos;
}
/**
* Get detcursos
*
* @return Doctrine\Common\Collections\Collection
*/
public function getDetcursos()
{
return $this->detcursos;
}
/**
* Add historiales
*
* @param Gitek\UdaBundle\Entity\Historial $historiales
*/
public function addHistorial(\Gitek\UdaBundle\Entity\Historial $historiales)
{
$this->historiales[] = $historiales;
}
/**
* Get historiales
*
* @return Doctrine\Common\Collections\Collection
*/
public function getHistoriales()
{
return $this->historiales;
}
/**
* Get historial
*
* @return Doctrine\Common\Collections\Collection
*/
public function getHistorial()
{
return $this->historial;
}
/**
* Set tiempo
*
* @param integer $tiempo
*/
public function setTiempo($tiempo)
{
$this->tiempo = $tiempo;
}
/**
* Get tiempo
*
* @return integer
*/
public function getTiempo()
{
return $this->tiempo;
}
}
As I said, in app_dev works correctly.
You can have different metadata cache configurations depending on which environment you are in. For example
apccan cause troubles if not correctly refreshed.Anyway, you will have to warmup your cache in prod environment, like this:
If this still doesn’t work, try to change your doctrine cache configuration:
This will use the
arraycache driver, which is refreshed once at every request.You shouldn’t use this in production, but it can help you to understand where you problem comes from.