本文整理汇总了PHP中AppModel::set方法的典型用法代码示例。如果您正苦于以下问题:PHP AppModel::set方法的具体用法?PHP AppModel::set怎么用?PHP AppModel::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppModel
的用法示例。
在下文中一共展示了AppModel::set方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeSave
/**
* 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));
}
}
示例2: set
/**
* 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']);
}
}
示例3: beforeSave
/**
* 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;
}
示例4: set
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);
}
示例5: set
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;
}
示例6: set
/**
* 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;
}
示例7: set
/**
* 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);
}
示例8: set
/**
* 保存対象のデータを設定する
*
* @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);
}