Ver Mensaje Individual
  #10 (permalink)  
Antiguo 17/12/2012, 16:45
necbalaam
 
Fecha de Ingreso: abril-2012
Mensajes: 25
Antigüedad: 12 años, 7 meses
Puntos: 0
Respuesta: Problemas con consulta symfony

Hice un cambio... he creado la relacion con uno de los atributos:

Código:
<?
namespace cnt\HBBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use cnt\HBBundle\Entity\CategoryDescriptions;
use cnt\HBBundle\Entity\Zones;
use Symfony\Component\Validator\Constrainst as Assert;

/**
* @ORM\Entity(repositoryClass="cnt\HBBundle\Entity\HotelsRepository")
* @ORM\Table(name="HOTELS")
*/

class Hotels 
{
    /**
    * @ORM\Id 
    * @ORM\Column(name="HOTELCODE",type="string", length=8, unique=true)
    */
    protected $hotelcode;
    /**
    * @ORM\OneToMany(targetEntity="HotelDescriptions", mappedBy="descriptions")
    */
   protected $descriptions;

   /**
    * @ORM\Column(name="NAME",type="string", length=50)
    */
    protected $name;
 
    /**
    * @ORM\OneToMany(targetEntity="CATEGORY_DESCRIPTION", mappedBy="HOTELS")
    * @ORM\Column(name="CATEGORYCODE",type="string", length=5)	
    */
    protected $categorycode;

   	/**
    * @ORM\Column(name="DESTINATIONCODE",type="string", length=3)
    */
    protected $destinationcode;
    
   /**
    * @ORM\ManyToOne(targetEntity="ZONES", inversedBy="HOTELS")
    * @ORM\Column(name="ZONECODE",type="string", length=8, nullable=true)
    */
    protected $zonecode = null;
 
    /**
    * @ORM\Column(name="CHAINCODE",type="string", length=5, nullable=true)
    */
    protected $chaincode = null;
    
    /**
    * @ORM\Column(name="LICENCE",type="string", length=15, nullable=true)
    */
    protected $licence = null;

    /**
    * @ORM\Column(name="LATITUDE",type="string", length=45, nullable=true)
    */
    protected $latitude = null;

    /**
    * @ORM\Column(name="LONGITUDE",type="string", length=45, nullable=true)
    */
    protected $longitude = null;

}
y de igual forma use asi mi función:

Código:
public function findByname($params){
			$name= $params['name'];
                        $language= $params['language'];
                        
                        $em = $this->getEntityManager();
			$query = $em->createQuery(' SELECT h, d
                                                    FROM cntHBBundle:Hotels h
                                                    JOIN h.descriptions d 
                                                    WHERE h.hotelcode = :id 
                                                    AND d.languagecode= :language                                                    
                                                     
                                                    ');
			$query->setParameter('id',$name);
                        $query->setParameter('language',$language);
			$query->setMaxResults(1);			
			$names = $query->getResult();
		return $names;
		}
Y lo que me sale ahorita es lo siguiente:

Notice: Undefined index: descriptions in /home5/punkmktc/cnt/Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php line 823