On Apr 20, 3:34 am, "Pablo Vergara B." <[email protected]>
wrote:
>
> Well this is the thing:
> I'm making small invoice system. I already made my small database
> design (which can be seen in the image below), models and their
> associations, default controllers and views (using the cake bake
> script).
> I tried to follow ALL the cakePHP conventions and rules to make myself
> the things easier and it seems it worked.
>
> <a href="http://imgur.com/AqIAq.png"; title="Hosted by
> imgur.com">http://imgur.com/AqIAq.png</a>
>
> http://imgur.com/AqIAq.png(direct link if the html link doesn't
> works)

As I understand the question, this is the view for
FacturasController::index. So, you want to display a list of invoices,
along with the Product name and the Client details. So, if your
associations are all correct, you should be able to do a find('all')
from Factura and it will pull in the Linea, Product, and Client
details. Try setting 'recursive' to 2 and see what it returns. Even
better, use ContainableBehavior:

$this->set(
        'data',
        $this->Factura->find(
                'all',
                'contain' => array(
                        'Linea' => array(
                                'Product'
                        ),
                        'Cliente'
                )
        )
);

I think that should work. Make sure to add Containable to the Facturs
model's $actsAs array (or to AppModel's to make it available
everywhere).

Add debug($data) at the top of your view to see the array structure.

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