Hi

I was wondering if someone could help me with saving the data of a
join table, when it has extra fields in cake 1.2?

I have read Mariano Iglesias' helpful blog post relating to this,
where he explains the findings of the 'with' specified model, which
was a great help. However, I am still unable to solve my problem -
sorry if I am being dense over it!

I have a model PlantItem and it is HABTM Specification.

I have to also include a field in the join table
(plant_items_specifications) alt_description to allow a particular
descriptive comment about this particular pairing.

So I have a user form where they add a new Plant Item,  and I want to
allow them to note which specifications it should have (it is a kind
of technical catalogue I am building) also.

I can see there are 2 ways to do this possibly:

1) have a multiple record section on this add form

Spec 1 - spec1name [x] spec1name_alt_description [_______]
Spec 2 spec2name [x] spec2name_alt_description [_______]
Spec 3 - spec3name [x] spec3name_alt_description [_______]

etc - 1 for each spec...

and try and save that along with the PlantITem data there and then.

2) have a second step after saving the PlantItem, using a basic
controller for the join-model PlIsSpec and a form where the new
created Plant_Item id can now be embedded,  that wd be like:

Spec 1 - spec1name [x] spec1name_alt_description [_______] (hidden
PlantItem id)
Spec 2 spec2name [x] spec2name_alt_description [_______] (hidden
PlantItem id)
Spec 3 - spec3name [x] spec3name_alt_description [_______] (hidden
PlantItem id)

and then do a multi-save. I think the 2nd way looks a better start for
me as it is walking before running, so-to-speak. Also I think it will
be easier to create an edit form in this case.

If anyone can help me I would be very grateful as I am keen to do the
most Cake way and learn a bit more about these concepts.

Useful references for this question:

detailed blog post:
http://cricava.com/blogs/index.php?blog=6&title=modelizing_habtm_join_tables_in_cakephp_&more=1&c=1&tb=1&pb=1

manual:
http://book.cakephp.org/view/85/saving-related-model-data-habt
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to