For some reason, my model’s save method is creating records in the database but the fields are all empty or zeroes.
The form should allow for creating multiple records with a single form submission.
My $this->data array:
Array
(
[OfferingStudent] => Array
(
[0] => Array
(
[offering_id] => 35
[owing] => 209.00
[student_id] => 31
)
)
)
Using the save method: $this->Students->OfferingsStudent->saveAll($this->data)
What could be causing this?
I believe when using
saveAllyou don’t actually include the name of the model in the array. Try changing your data to just this:http://book.cakephp.org/view/1031/Saving-Your-Data
from that page:
or rather, just use
$this->data->OfferingStudentas the first argument to saveAll instead of just$this->data