using 2.3.5
I have an 'uploads' table, with columns 'model' and 'foreign_key'. The
Upload model uses the behavior in Nick Baker's FileUpload plugin. This
isn't the first time I've used it, and in fact I've used the
model/foreign_key approach for quite a lot of other things with Cake. But
for some reason in this latest app the 'model' key is being unset from the
data.
I'm logging the data in several places. Here it is after the associated
model has been saved, where the model and f_k values are saved to
Upload->data. That is, I used $this->log($this->Upload->data);
2013-06-11 20:50:02 Error: JobApplication::afterSave
2013-06-11 20:50:02 Error: Array
(
[Upload] => Array
(
[file] => Array
(
[name] => snu.txt
[type] => text/plain
[tmp_name] => /tmp/phpE3aWNC
[error] => 0
[size] => 2340
)
[model] => JobApplication
[foreign_key] => 8
)
)
But then right after that, in the behavior:
2013-06-11 20:50:02 Error: FileUploadBehavior::beforeSave
2013-06-11 20:50:02 Error: Array
(
[Upload] => Array
(
[foreign_key] => 8
[file] => Array
(
[name] => snu.txt
[type] => text/plain
[tmp_name] => /tmp/phpE3aWNC
[error] => 0
[size] => 2340
)
[created] => 2013-06-11 20:50:02
)
)
I've explicitly included the 'model' key in the fieldList:
public function persist($data) {
$options = array(
'fieldList' => array(
$this->alias => array(
'created',
'job_id',
'first_name',
'last_name',
'email',
'msg'
),
'Upload' => array(
'created',
'model',
'foreign_key',
'file_name',
'file_type',
'file_size'
)
)
);
return $this->saveAssociated($data, $options);
}
I've even changed 'model' to 'foo' -- in both $data and the fieldList --
but it too is removed.
What else could it be?
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.