Ver Mensaje Individual
  #1 (permalink)  
Antiguo 26/03/2015, 17:31
EricMedina
 
Fecha de Ingreso: marzo-2015
Mensajes: 6
Antigüedad: 9 años, 5 meses
Puntos: 0
Error al setear objeto en formulario

Buenas! tengo un problema al intentar guardar 2 objetos, cliente y vehiculo en la BD a traves de un form, me tira el siguiente error:

Catchable Fatal Error: Argument 1 passed to taller\tallerBundle\Entity\vehiculo::setCliente() must be an instance of taller\tallerBundle\Entity\cliente, array given, called in C:\xampp\htdocs\symfony\vendor\symfony\symfony\src \Symfony\Component\PropertyAccess\PropertyAccessor .php on line 442 and defined
500 Internal Server Error - ContextErrorException

en el controlador tengo esto:

Código PHP:
.....

    
$cliente = new cliente();  
        
$vehiculo = new vehiculo();
        
$form $this-> createForm(new vehiculoType(), $vehiculo);
        
$form -> handleRequest($request);
        if (
$form ->isvalid()) {
                
$em $this -> getDoctrine()-> getManager();
                
$em -> persist($cliente);
                
$em -> persist($vehiculo);
                
$em -> flush();
..... 
clase vehiculo

Código PHP:
...

private 
$cliente;


    
/**
     * Set cliente
     *
     * @param \taller\tallerBundle\Entity\cliente $cliente
     * @return vehiculo
     */
    
public function setCliente(tallertallerBundleEntitycliente $cliente null)
    {
        
$this->cliente $cliente;

        return 
$this;
    }

    
/**
     * Get cliente
     *
     * @return \taller\tallerBundle\Entity\cliente 
     */
    
public function getCliente()
    {
        return 
$this->cliente;
    }

.. 
Estare atento a cualquier ayuda, muchisimas gracias
saludos