Tuesday, November 29, 2011

Has many problem

Hi all!

I have a problem and I'm not sure about the a solution. I have two options of creating a "process" table.

Option 1: table with 100 or more fields. Ugly, I don't want this. Fields:

process1_costtype1_data1
process1_costtype1_data2
process1_costtype1_data3

process1_costtype2_data1

..etc.

Option 2: "normalized" table with this fields:

process_name
cost_type
data1
data2
data3, etc.

I prefer the second option by far. But the problem is that I'm not sure when using the Form helper, if I can mantain the array indexes when using saveAll. I mean, when loading de data saved with saveAll for editing, I'm sure that the data loaded will be loaded in the same order that the data were saved? What happend if a register is missing? Then all will be wrong.

echo $this->Form->input("Process.0.process_name");
echo $this->Form->input("Process.0.cost_type");
...

echo $this->Form->input("Process.1.process_name");
echo $this->Form->input("Process.1.cost_type");

Data will be loaded in the same order that were saved?

Hugo Massaroli

--
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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: