/** * Updates and saves leave. * * @return bool */ public function update($data = array()) { if (isset($data['date_from']) || isset($data['date_to'])) { $this->_mapper->resetDaysByLeave($this); } foreach ($data as $k => $v) { $this->{$k} = $v; } return $this->save(); }