/**
  * Saves a data object to the model
  * @param mixed $data A data object of this model
  * @return null
  * @throws Exception when the data could not be saved
  */
 protected function saveData($data)
 {
     foreach ($this->automaticFields as $field) {
         $field->processSaveData($data);
     }
     parent::saveData($data);
 }
Beispiel #2
0
 /**
  * Save a node to the model
  * @param Node $node
  * @return null
  */
 protected function saveData($node)
 {
     if (isset($node->settings) && $node->settings instanceof NodeSettings) {
         $settings = $node->settings;
         unset($node->settings);
     }
     if (!$node->id) {
         if (!$node->orderIndex) {
             $node->orderIndex = $this->getNewOrderIndex($node->parent);
         }
     } else {
         $oldRoute = $this->getRouteForNode($node->id, $node->dataLocale);
         if ($oldRoute && $node->route != $oldRoute) {
             $expiredRouteModel = $this->getModel(ExpiredRouteModel::NAME);
             $expiredRouteModel->addExpiredRoute($oldRoute, $node->id, $node->dataLocale);
         }
     }
     parent::saveData($node);
     if (isset($settings)) {
         $node->settings = $settings;
         $nodeSettingModel = $this->getModel(NodeSettingModel::NAME);
         $nodeSettingModel->setNodeSettings($node->settings);
     }
 }