当前位置: 首页>>代码示例>>PHP>>正文


PHP AppModel::set方法代码示例

本文整理汇总了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));
		}
	}
开发者ID:ntung,项目名称:i18n,代码行数:12,代码来源:i18nable.php

示例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']);
     }
 }
开发者ID:Galvanio,项目名称:Kinspir,代码行数:14,代码来源:commit.php

示例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;
 }
开发者ID:hadzi,项目名称:brekfarm,代码行数:16,代码来源:owned.php

示例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);
 }
开发者ID:buiquangquyet,项目名称:ipost,代码行数:11,代码来源:User.php

示例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;
 }
开发者ID:roboshed,项目名称:Zuluru,代码行数:11,代码来源:event.php

示例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;
 }
开发者ID:Theaxiom,项目名称:chaw-source,代码行数:25,代码来源:ssh_key.php

示例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);
 }
开发者ID:josegonzalez,项目名称:cakephp-entity,代码行数:19,代码来源:Table.php

示例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);
 }
开发者ID:Shiro-Nwal,项目名称:sin-kaisha-khine,代码行数:17,代码来源:AppMstModel.php


注:本文中的AppModel::set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。