Exemple #1
0
 public function save()
 {
     $current = $this->getTable()->getReferenceMap($this->_getExtend());
     if (isset($this->{$current['columns']}) && $this->pk !== $this->{$current['columns']}) {
         foreach ($this->_data as $key => &$value) {
             if (!$this->_isExtendable($key) || $value != $this->{$this->_getExtend()}->{$key}) {
                 continue;
             }
             $value = null;
         }
     }
     return parent::save();
 }
Exemple #2
0
 /**
  * @param null|array $values
  * @return Centurion_Db_Table_Row_Abstract|null
  */
 public function saveInstance($values = null)
 {
     if ($values === null) {
         $values = $this->getValues();
     }
     $values = $this->_saveReferenceSubForms($this->_processValues($values));
     if (!$this->hasInstance()) {
         $this->_isNew = true;
         $this->_instance = $this->getModel()->createRow();
     } else {
         $this->_instance->setReadOnly(false);
     }
     $this->_instance->setFromArray($values);
     $this->_preSave();
     Centurion_Signal::factory('pre_save')->send($this);
     $this->_instance->save();
     $this->_saveManyDependentTables();
     $this->_postSave($this->_isNew);
     Centurion_Signal::factory('post_save')->send($this);
     return $this->_instance;
 }