/**
  * wrapper for update
  *
  * @param Validation $validation
  * @return ORM
  */
 public function update(Validation $validation = NULL)
 {
     // hook
     Event::raise($this, Event::BEFORE_UPDATE, array('model' => $this));
     // update
     $result = parent::update($validation);
     // hook
     Event::raise($this, Event::AFTER_UPDATE, array('model' => $this));
     // return orm
     return $result;
 }
Exemplo n.º 2
0
 public function update(Validation $validation = NULL)
 {
     $this->before_save();
     $this->before_update();
     $need_count = FALSE;
     if ($this->_deleted_column !== NULL && $this->changed($this->_deleted_column['column'])) {
         $need_count = TRUE;
     }
     if ($this->_published_column !== NULL && $this->changed($this->_published_column['column'])) {
         $need_count = TRUE;
     }
     parent::update($validation);
     if ($need_count === TRUE) {
         $this->update_count();
     }
     $this->after_update();
     $this->after_save();
     return $this;
 }
Exemplo n.º 3
0
 /**
  * Updates or Creates the record depending on loaded()
  *
  * @chainable
  * @param  Validation $validation Validation object
  * @return ORM
  */
 public function update(Validation $validation = NULL)
 {
     if (!$this->before_save()) {
         return FALSE;
     }
     if (!$this->before_update()) {
         return FALSE;
     }
     parent::update($validation);
     $this->after_update();
     $this->after_save();
     return $this;
 }
Exemplo n.º 4
0
 /**
  * Updates a single record or multiple records
  *
  * @chainable
  * @param  Validation $validation Validation object
  * @return ORM
  */
 public function update(Validation $validation = NULL)
 {
     try {
         parent::update($validation);
         $this->_update_foreign_fields();
     } catch (Kohana_Exception $e) {
         throw $e;
     }
     return $this;
 }