tags:

views:

52

answers:

1

If I have posted to controller with data and save that data with...

$this->Flo->save($this->data)

Is there a way for me to insert a name/value pair into that data object before I run the save?

+4  A: 

Do you mean something like this?

$this->data['Flo']['name'] = $value;
$this->Flo->save($this->data);
Brian McKenna
Yep... I swear... sometimes I get freaked out at how simple this is and I totally over think these things. Thanks!
Selino
If $value is something that could be separated from the request, I would put it in the Model::beforeSave(...) method. So if it's something like the User id (thus more request-oriented than data/model oriented) I'd do it as above. If it's something like adding the date, I'd put it in the model. Note: this is due to my preference for skinny controllers, so YMMV.
Travis Leleu