本文整理汇总了PHP中ORM::create方法的典型用法代码示例。如果您正苦于以下问题:PHP ORM::create方法的具体用法?PHP ORM::create怎么用?PHP ORM::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ORM
的用法示例。
在下文中一共展示了ORM::create方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createmodels
public function createmodels()
{
if (!auth::check(self::AUTH_REALM)) {
$this->access_denied();
}
$created = 0;
$models = $this->getModels();
foreach ($models as $id => $model) {
if (!$model['status']) {
$created++;
$filename = substr($model['info']['basename'], 0, strpos($model['info']['basename'], '.xml'));
ORM::create($filename);
}
}
$this->msg = "<strong>{$created} models</strong> created successfuly.";
$this->database();
}
示例2: create
/**
* Wrap Idiorm's create method to return an
* empty instance of the class associated with
* this wrapper instead of the raw ORM class.
*
* return ORMWrapper|bool
*/
public function create($data = null)
{
return $this->_create_model_instance(parent::create($data));
}
示例3: create
public function create(Validation $validation = null)
{
$this->token = $this->create_token();
return parent::create($validation);
}
示例4: create
/**
* Insert a new object to the database
* @param Validation $validation Validation object
* @return ORM
*/
public function create(Validation $validation = NULL)
{
parent::create($validation);
$this->reload_config();
}
示例5: create
public function create(Validation $validation = NULL)
{
$user = user::get();
$this->user_id = $user->id;
$this->created = $user->timestamp();
$this->day = user::get()->today_slug();
return parent::create($validation);
}
示例6: create
/**
* Wrap Idiorm's create method to return an
* empty instance of the class associated with
* this wrapper instead of the raw ORM class.
*
* @param array $data associate array of data to fill the model
*
* @return Model
*/
public function create($data = null)
{
return $this->createModelInstance(parent::create($data));
}
示例7: create
/**
* Override the create method with defaults
*
* @param Validation $validation Validation object [Optional]
*
* @return ORM
*
* @throws Gleez_Exception
*/
public function create(Validation $validation = NULL)
{
if ($this->_loaded) {
throw new Gleez_Exception('Cannot create :model model because it is already loaded.', array(':model' => $this->_object_name));
}
$this->init = $this->mail;
$this->status = 1;
return parent::create($validation);
}
示例8: get_block
$block = ORM::factory('blocktype')->where('contenttype_id', '=', $this->content->contenttype_id)->where('key', '=', $key)->find();
if ((bool) $block->loaded()) {
$block = $this->blocks->where('blocktype_id', '=', $block->id)->find_all();
if ((bool) $block->count()) {
return $block;
}
}
return false;
}
// alias
public function get_block($key)
{
return $this->get_block_by_key($key);
}
public function get_blocks()
{
return $this->blocks->where('parent', '=', $this->id)->find_all();
}
public function create(Validation $validation = NULL)
{
示例9: save
/**
* Saves the current object. Will hash password if it was changed.
*
* @return ORM
*/
public function save()
{
if (array_key_exists('password', $this->_changed)) {
$this->_object['password'] = Auth::instance()->hash_password($this->_object['password']);
}
if (isset($this->_object['id'])) {
return parent::update();
} else {
return parent::create();
}
}
示例10: create
public function create(Validation $validation = NULL)
{
$this->created = time();
return parent::create($validation);
}