Ver Mensaje Individual
  #11 (permalink)  
Antiguo 09/05/2013, 14:17
daymerrf
 
Fecha de Ingreso: febrero-2013
Mensajes: 66
Antigüedad: 11 años, 1 mes
Puntos: 0
Respuesta: Consulta DQL no devuelve un valor

Código:
class Capitulo
{   
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

   
    /**
     * @var string
     *
     * @ORM\Column(name="descripcion", type="text", nullable=true)
     */
    private $descripcion;
    
    /**
     * @var string
     *
     * @ORM\Column(name="nombre_original", type="string", length=255)    
     */
    private $nombre_original;

    /**
     * @var integer
     *
     * @ORM\Column(name="cantidad_vista", type="integer")
     */
    private $cantidad_vista;

    /**
    * @ORM\ManyToOne(targetEntity="Serie", inversedBy="capitulos")
    * @ORM\JoinColumn(name="serie_id", referencedColumnName="id", onDelete="Cascade")
    * @Assert\NotBlank()
    */
    private $serie;

     /**
     * @var string
     *
     * @ORM\Column(name="capitulo", type="string", length=255)
     * @Assert\NotBlank()
     * @Assert\File(maxSize = "200M", mimeTypes = {"video/webm", "application/octet-stream"})
     */
    private $capitulo;
    
    /**
     * @var \DateTime
     *
     * @ORM\Column(name="fecha", type="datetime")
     */
    private $fecha;
    
    /**
     * @var integer
     *      
     * @ORM\OneToMany(targetEntity="Animes\FrontendBundle\Entity\Comentario", mappedBy="capitulo")       
     */
    private $comentarios;


    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }
    
    /**
     * Set descripcion
     *
     * @param string $descripcion
     * @return Capitulo
     */
    public function setDescripcion($descripcion)
    {
        $this->descripcion = $descripcion;
    
        return $this;
    }

    /**
     * Get descripcion
     *
     * @return string 
     */
    public function getDescripcion()
    {
        return $this->descripcion;
    }    

    /**
     * Set cantidad_vista
     *
     * @param integer $cantidadVista
     * @return Capitulo
     */
    public function setCantidadVista($cantidadVista)
    {
        $this->cantidad_vista = $cantidadVista;
    
        return $this;
    }

    /**
     * Get cantidad_vista
     *
     * @return integer 
     */
    public function getCantidadVista()
    {
        return $this->cantidad_vista;
    }

    /**
     * Set serie
     *
     * @param \Animes\BackendBundle\Entity\Serie $serie
     * @return Capitulo
     */
    public function setSerie(\Animes\BackendBundle\Entity\Serie $serie = null)
    {
        $this->serie = $serie;
    
        return $this;
    }

    /**
     * Get serie
     *
     * @return \Animes\BackendBundle\Entity\Serie 
     */
    public function getSerie()
    {
        return $this->serie;
    }

    /**
     * Set capitulo
     *
     * @param string $capitulo
     * @return Capitulo
     */
    public function setCapitulo($capitulo)
    {
        $this->capitulo = $capitulo;
    
        return $this;
    }

    /**
     * Get capitulo
     *
     * @return string 
     */
    public function getCapitulo()
    {
        return $this->capitulo;
    }
    /**
     * Set nombre_original
     *
     * @param string $nombreOriginal
     * @return Capitulo
     */
    public function setNombreOriginal($nombreOriginal)
    {
        $this->nombre_original = $nombreOriginal;
    
        return $this;
    }

    /**
     * Get nombre_original
     *
     * @return string 
     */
    public function getNombreOriginal()
    {
        return $this->nombre_original;
    }

    /**
     * Set fecha
     *
     * @param \DateTime $fecha
     * @return Capitulo
     */
    public function setFecha($fecha)
    {
        $this->fecha = $fecha;
    
        return $this;
    }

    /**
     * Get fecha
     *
     * @return \DateTime 
     */
    public function getFecha()
    {
        return $this->fecha;
    }
    /**
     * Constructor
     */
    public function __construct()
    {
        $this->comentarios = new \Doctrine\Common\Collections\ArrayCollection();
    }
    
    /**
     * Add comentarios
     *
     * @param \Animes\FrontendBundle\Entity\Comentario $comentarios
     * @return Capitulo
     */
    public function addComentario(\Animes\FrontendBundle\Entity\Comentario $comentarios)
    {
        $this->comentarios[] = $comentarios;
    
        return $this;
    }

    /**
     * Remove comentarios
     *
     * @param \Animes\FrontendBundle\Entity\Comentario $comentarios
     */
    public function removeComentario(\Animes\FrontendBundle\Entity\Comentario $comentarios)
    {
        $this->comentarios->removeElement($comentarios);
    }

    /**
     * Get comentarios
     *
     * @return \Doctrine\Common\Collections\Collection 
     */
    public function getComentarios()
    {
        return $this->comentarios;
    }
    
    public function __toString() {
        return $this->getNombreOriginal();
    }
}
Código:
class Genero
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="genero", type="string", length=255)
     */
    private $genero;

    /**
     * @var string
     *
     * @ORM\Column(name="descripcion", type="text",  nullable=true)
     */
    private $descripcion;

    /**
    * @ORM\OneToMany(targetEntity="SerieGenero", mappedBy="genero")
    */
    protected $series;

    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set genero
     *
     * @param string $genero
     * @return Genero
     */
    public function setGenero($genero)
    {
        $this->genero = $genero;
    
        return $this;
    }

    /**
     * Get genero
     *
     * @return string 
     */
    public function getGenero()
    {
        return $this->genero;
    }

    /**
     * Set descripcion
     *
     * @param string $descripcion
     * @return Genero
     */
    public function setDescripcion($descripcion)
    {
        $this->descripcion = $descripcion;
    
        return $this;
    }

    /**
     * Get descripcion
     *
     * @return string 
     */
    public function getDescripcion()
    {
        return $this->descripcion;
    }
    
    public function __toString() {
        return $this->genero;
    }
}