Friday, October 8, 2010

HABTM with an extra field (saving)

I have an issue where my HABTM save isn't quite working. I mean it
is, but it's throwing a few notices to Cake, which I'm concerned
about:
Notice (8): Undefined index: id [CORE/cake/libs/model/model.php, line
1391]
Notice (8): Undefined index: id [CORE/cake/libs/model/model.php, line
1329]

I know if I turn off debug, these messages won't show but still, it's
a cause for concern for me.

So I have 3 tables in total...

reviews table:
id
title
(more fields, but irrelevant)

criterias table
id
title
(more fields but irrelevant)

and a joining table, which is HABTM

criteria_review table
criteria_id
review_id
value *

* that's the extra field I'm talking about.

now, in my view code, I copied the way the standard automagic multi-
select named stuff and came up with this:

<?php echo $this->Form->input('Criteria.Criteria.'.
$i.'.criteria_id', array('label' => false, 'type'=>'hidden', 'value'=>
$key)); ?>
<?php echo $this->Form->input('Criteria.Criteria.'.$i.'.value',
array('label' => false, 'type'=>'select', 'options'=>array('1'=>'1 out
of 5','2'=>'2 out of 5','3'=>'3 out of 5','4'=>'4 out of 5','5'=>'5
out of 5'))); ?>

It saves ok, but it throws those notices up there. Any ideas on what
I'm doing wrong or what could be causing that?

Or if you have a better way to deal with EXACTLY what I'm going thru,
please, by all means, explain your way.

Thanks,
Jake

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate