Hola,
  Como va??? Yo soy de Argentina. Espero que sea esto lo que estabas
buscando, sino contame en español lo que necesitas y veo si te puedo dar una
mano. El único problema que tuve con una consulta similar a esta es que no
la pude ordenar por todos los campos, y no encontré como hacer eso por
ahora, pero el listado me lo hizo OK.

function index() {
  $this->Factura->recursive = 0;
  $this->paginate = array(
    'Factura' => array(
      'joins' => array(
        array(
          'table' => 'clientes',
          'alias' => 'Cliente',
          'type' => 'inner',
          'conditions' => array(
            'Factura.cliente_id = Cliente.id'
          )
        ),
        array(
          'table' => 'lineas_facturas',
          'alias' => 'LineasFactura',
          'type' => 'inner',
          'conditions' => array(
            'Factura.id = LineasFactura.factura_id'
          )
        ),
        array(
          'table' => 'lineas',
          'alias' => 'Linea',
          'type' => 'inner',
          'conditions' => array(
            'Linea.id = LineasFactura.linea_id'
          )
        ),
        array(
          'table' => 'productos',
          'alias' => 'Producto',
          'type' => 'inner',
          'conditions' => array(
            'Linea.producto_id = Producto.id'
          )
        )
      ),
      'fields' => array('Factura.numeroFactura', 'Factura.fecha',
'Cliente.rut', 'Cliente.apellidos', 'Cliente.nombres',
'Producto.descripcion', 'Linea.cantidad', 'Producto.precio')
    )
  );
  $data = $this->paginate('Factura');
  $this->set('facturas', $data);
}

Saludos
Notinyes

PD: Acá te mandé el paginate, pero un find sería bastante similar.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to