Tuesday, October 27, 2009

Re: HABTM and extra field

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: