/** * Save object (create or update) * * @param t41\Backend\Adapter\AbstractAdapter $backend * @return boolean */ public function save(Backend\Adapter\AbstractAdapter $backend = null) { $this->_triggerRules('before/save'); if (!$this->_uri instanceof ObjectUri) { $new = true; $this->_triggerRules('before/create'); } $result = Backend::save($this->_dataObject, $backend); $this->_triggerRules('after/save'); if (isset($new)) { $this->_triggerRules('after/create'); } return $result; }
/** * Returns the value of the given property * */ public function getAction() { try { $res = $this->_obj->getProperty($this->_post['property']); $res->getValue(); // if the save flag is defined, force object saving if (isset($this->_post['save'])) { Backend::save($res->getParent()); $this->_refreshCache = true; } $this->_data = $res->reduce(array('params' => array())); } catch (\Exception $e) { $this->_context['message'] = $e->getMessage(); $this->_status = 'ERR'; } if ($this->_obj->status instanceof Core\Status) { $this->_context['message'] = $this->_obj->status->getMessage(); $this->_context['context'] = $this->_obj->status->getContext(); } $this->_status = $res ? 'OK' : 'NOK'; }
/** * Save object * * @return boolean */ public function save(Backend\Adapter\AdapterAbstract $backend = null) { return \t41\Backend::save($this->_dataObject, $backend); }