Hi all.

i have 2 models, Articles and Pieces.

They should've been linked by a HABTM but i need to save some additional 
fields in the join table so i made 2x hasMany.
Here's my situation:

Article hasMany ArticlePiece
Piece hasMany  ArticlePiece 
ArticlePiece belongsTo Article
ArticlePiece belongsTo Piece

How can i load an article, with ALL the pieces, even if they haven't a 
relationship, using Cake's find function?

i need an array like this:

Array
(
[Article] => Array
(
[id] => 1
[code] => XY
[description] => rotflrotflrotfl
)

[ArticlePiece] => Array
(
[0] => Array
(
[id] => 1
[article_id] => 1
[piece_id] => 1
[quantity] => 10.00
[cost_each] => 5.00
)

[1] => Array
(
[id] => 2
[article_id] => 1
[piece_id] => 2
[quantity] => 3.00
[cost_each] => 15.00
)

[2] => Array
(
[id] => 3
[article_id] => 1
[piece_id] => 3
[quantity] => //no cost, no quantity = not related
[cost_each] => //no cost, no quantity = not related
)

)
)

Sorry for my bad english

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to