/** * Set current language * * @param AppModel $Model */ public function beforeSave(&$Model) { $settings = $this->settings[$Model->alias]; $language = Configure::read('Config.language'); if ($Model->hasField($settings['languageField'])) { $Model->set(array($settings['languageField'] => $language)); } }
/** * undocumented function * * @param string $one * @param string $two * @return void */ function set($one = array(), $two = null) { parent::set($one, $two); if (!empty($this->data)) { $this->data['Commit'] = array_merge(array('user_id' => null, 'event' => 'committed', 'data' => 0), $this->data['Commit']); } }
/** * beforeSave callback, initializes created_by or modified_by field values * * @param AppModel $Model * @return boolean * @access public */ public function beforeSave($Model) { $field = $Model->exists() ? 'modified_by' : 'created_by'; if ($Model->hasField($field)) { $Model->set($field, $this->_getUserId()); $this->_addToWhitelist($Model, $field); } return true; }
public function set($inputData, $two = null) { if (is_array($inputData)) { if (!empty($inputData['User']['password'])) { $hash = AuthComponent::password($inputData['User']['password']); $inputData['User']['password'] = $hash; } } // 入力チェック用にパラメータを設定 parent::set($inputData, $two); }
function set($one, $two = null) { if (array_key_exists('EventType', $one)) { $this->event_obj = AppController::_getComponent('EventType', $one['EventType']['type']); } $data = parent::set($one, $two); if (array_key_exists('EventType', $one)) { unset($this->event_obj); } return $data; }
/** * undocumented function * * @param string $data * @return void */ function set($data = array()) { parent::set($data); if (empty($this->data['SshKey']['type'])) { return false; } $this->type = strtolower($this->data['SshKey']['type']); $path = Configure::read("Content.{$this->type}") . 'repo' . DS . '.ssh' . DS . 'authorized_keys'; if (!empty($this->_File) && $this->_File->path == $path) { if ($this->_File->exists() != true) { $this->_File->create(); $this->lines = $this->user = array(); } return true; } $this->_File = new File($path, true); $this->lines = $this->user = array(); return true; }
/** * Override. To support passing entity to set() directly. * Because save() will pass its data to set(), you can now * call save() with entity like this: * * $Model->save($entity); * * @param string|array|SimpleXmlElement|DomNode $one Array or string of data * @param string $two Value string for the alternative indata method * @return array Data with all of $one's keys and values * @link http://book.cakephp.org/2.0/en/models/saving-your-data.html */ public function set($one, $two = null) { if ($one instanceof Entity) { $one = $one->toArray(); } return parent::set($one, $two); }
/** * 保存対象のデータを設定する * * @param type $one * @param type $two * @return type */ public function set($one, $two = null) { $deleted = $this->deleted; $alias = $this->alias; $deleteFlag = $this->logicDeleteFlag; if ($deleteFlag && isset($one[$alias][$deleted])) { unset($one[$alias][$deleted]); } return parent::set($one, $two); }