Ver Mensaje Individual
  #19 (permalink)  
Antiguo 06/03/2014, 10:41
daymerrf
 
Fecha de Ingreso: febrero-2013
Mensajes: 66
Antigüedad: 11 años, 2 meses
Puntos: 0
Respuesta: Consulta DQL no devuelve un valor

Código PHP:
<?php

namespace HostalesBackendBundleEntity
;

use 
DoctrineORMMapping as ORM;

/**
 * HostalServicio
 *
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="Hostales\BackendBundle\Entity\HostalServicioRepository")
 */
class HostalServicio
{
    
/**
     * @ORM\Id
     * @ORM\ManyToOne(targetEntity="Hostal", inversedBy="servicios", cascade={"persist"})
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="hostal_id", referencedColumnName="id", onDelete="Cascade")
     * })
     */
     
    
private $hostal;

    
/**
     * @ORM\Id
     * @ORM\ManyToOne(targetEntity="Servicio")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="servicio_id", referencedColumnName="id", onDelete="Cascade")
     * })
     */
    
private $servicio;
    

    
/**
     * Set hostal
     *
     * @param \Hostales\BackendBundle\Entity\Hostal $hostal
     * @return HostalServicio
     */
    
public function setHostal(HostalesBackendBundleEntityHostal $hostal)
    {
        
$this->hostal $hostal;

        return 
$this;
    }

    
/**
     * Get hostal
     *
     * @return \Hostales\BackendBundle\Entity\Hostal 
     */
    
public function getHostal()
    {
        return 
$this->hostal;
    }

    
/**
     * Set servicio
     *
     * @param \Hostales\BackendBundle\Entity\Servicio $servicio
     * @return HostalServicio
     */
    
public function setServicio(HostalesBackendBundleEntityServicio $servicio)
    {
        
$this->servicio $servicio;

        return 
$this;
    }

    
/**
     * Get servicio
     *
     * @return \Hostales\BackendBundle\Entity\Servicio 
     */
    
public function getServicio()
    {
        return 
$this->servicio;
    }
}
Y en esta imagen ven como el último servicio es null