Wednesday, October 28, 2009

Re: HABTM and extra field

Product hasMany PackagesProduct
Package hasMany PackagesProduct

PackagesProduct hasOne Product
PackagesProduct hasOne Package

You can replace PackagesProduct with the semantic name you want, but
you don't have to.

( Excuse my bad English! )

sersilva

2009/10/28 kicaj <kicaj@kdev.pl>:
>
> Yes, but this example it's not for me, listen:
> I have Product with many Package, and Package have 'cost' per Product
> with Package
>
> Explain (product, cost/package):
> 1. Milk cost $1/1l
> 2. Milk cost $1,50/2l
> 3. Coffe cost $2/1l
>
> I have many Product
> I have many Package
> And I have many cost for each Package of Product
>
> I can't write like this:
> Product HABTM Package
> Package hasOne Price (with 'cost' field)
> because different Package have different Price.cost
>
> On Oct 28, 12:55 am, Sergio Silva <ssil...@gmail.com> wrote:
>> I recommend you this reading:http://book.cakephp.org/view/85/Saving-Related-Model-Data-HABTM
>>
>> When it says "What to do when HABTM becomes complicated?"
>>
>> Good luck
>>
>> 2009/10/27 kicaj <ki...@kdev.pl>:
>>
>>
>>
>> > I have relations:
>>
>> > Products HABTM Package
>>
>> > Table 'packages_products' has fields: id, package_id, product_id and
>> > extra field cost (varchar)
>>
>> > How build form for this form with select input width packages?
> >
>

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

No comments: