Ejemplo n.º 1
0
 /**
  * @see RM_Store_Object::save()
  */
 public function save()
 {
     if (!$this->_existsInDb()) {
         $this->_mapper->access($this, 'CATEGORY.CREATE');
     }
     if (!$this->owner_id) {
         $this->owner_id = -1;
     }
     if (!$this->generaltype_id && $this->name) {
         $this->generaltype_id = M('Guid')->get(G('generaltype-fake'));
     }
     if (!$this->cdate) {
         $this->cdate = M('Date')->dbDateTime();
     }
     $mask = array();
     foreach ($this->_props as $name => $value) {
         if ($value != $this->_propInitial($name)) {
             $mask = $this->_mapper->_getCheckMaskArray($name);
         }
     }
     $this->changed_by = me()->id();
     if ($mask) {
         $this->_mapper->access($this, join('|', $mask));
     }
     $this->mdate = M('Date')->dbDateTime();
     return parent::save();
 }