01.18
php
saved
ruxkor
Note
modified aftersave function in order to save fields like 'localizedfilename' => 'locale' => 'value'
modified aftersave function in order to save fields like 'localizedfilename' => 'locale' => 'value'
- function afterSave(&$model, $created) {
- return true;
- }
- $locale = $this->_getLocale($model);
- $tempData = $this->runtime[$model->alias]['beforeSave'];
- $RuntimeModel =& $this->translateModel($model);
- $translations = $RuntimeModel->find('list', array('conditions' => array_merge($conditions, array($RuntimeModel->displayField => array_keys($tempData)))));
- if ($translations) {
- foreach ($translations as $id => $field) {
- $RuntimeModel->create();
- }
- }
- }
- foreach ($tempData as $field => $value) {
- foreach ($value as $loc=>$val) {
- $RuntimeModel->create(array_unique(array_merge($conditions,$tmploc, array($RuntimeModel->displayField => $field, 'content' => $val))));
- $RuntimeModel->save();
- }
- }
- else {
- $RuntimeModel->create(array_merge($conditions, array($RuntimeModel->displayField => $field, 'content' => $value)));
- $RuntimeModel->save();
- }
- }
- }
- }
Parsed in 0.099 seconds, using GeSHi 1.0.7.14