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


PHP ActiveRecord::create方法代码示例

本文整理汇总了PHP中ActiveRecord::create方法的典型用法代码示例。如果您正苦于以下问题:PHP ActiveRecord::create方法的具体用法?PHP ActiveRecord::create怎么用?PHP ActiveRecord::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ActiveRecord的用法示例。


在下文中一共展示了ActiveRecord::create方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1:

 function test_should_not_insert_null_string_on_empty_binary_fields()
 {
     $this->installAndIncludeModels(array('Hybrid' => 'id,data binary'));
     $EmptyFile =& $this->Hybrid->create(array());
     $EmptyFile->reload();
     $this->assertNull($EmptyFile->get('data'));
 }
开发者ID:joeymetal,项目名称:v1,代码行数:7,代码来源:_AkActiveRecord_datatypes.php

示例2: create

 public function create()
 {
     parent::create();
     $this->type = srCertificateType::find($this->getTypeId());
     $this->createSettings();
     $this->createPlaceholderValues();
 }
开发者ID:studer-raimann,项目名称:Certificate,代码行数:7,代码来源:class.srCertificateDefinition.php

示例3:

 function test_handle_null_date_as_null()
 {
     $this->installAndIncludeModels(array('Hybrid' => 'id,name,born date'));
     $Hans =& $this->Hybrid->create(array('name' => 'Hans', 'born' => null));
     $Hans->reload();
     $this->assertNull($Hans->born);
 }
开发者ID:joeymetal,项目名称:v1,代码行数:7,代码来源:_AkActiveRecord_datatypes.php

示例4: create

 public static function create($values = array(), $save = false)
 {
     try {
         $Mapping = parent::create($values, $save);
     } catch (\DuplicateKeyException $e) {
         $Mapping = static::getByWhere(array('ContextClass' => $values['Context'] ? $values['Context']->getRootClass() : $values['ContextClass'], 'Connector' => $values['Connector'], 'ExternalKey' => $values['ExternalKey'], 'ExternalIdentifier' => $values['ExternalIdentifier']));
         $Mapping->ContextID = $values['Context'] ? $values['Context']->ID : $values['ContextID'];
         if ($save) {
             $Mapping->save();
         }
     }
     return $Mapping;
 }
开发者ID:nbey,项目名称:Emergence-Skeleton,代码行数:13,代码来源:Mapping.php

示例5: saveObject

 /**
  * @return bool
  */
 public function saveObject()
 {
     if (!$this->beforeSave()) {
         return false;
     }
     global $ilUser;
     /**
      * @var ilObjUser $ilUser
      */
     if (!$this->setArFieldsAfterSubmit()) {
         return false;
     }
     $modified_by_field = $this->getFields()->getModifiedByField();
     if ($modified_by_field) {
         $set_modified_by_function = $modified_by_field->getSetFunctionName();
         $this->ar->{$set_modified_by_function}($ilUser->getId());
     }
     $modification_date_field = $this->getFields()->getModificationDateField();
     if ($modification_date_field) {
         $set_modification_date_function = $modification_date_field->getSetFunctionName();
         $datetime = new ilDateTime(time(), IL_CAL_UNIX);
         $this->ar->{$set_modification_date_function}($datetime);
     }
     if ($this->ar->getPrimaryFieldValue() != 0) {
         $this->ar->update();
     } else {
         $created_by_field = $this->getFields()->getCreatedByField();
         if ($created_by_field) {
             $set_created_by_function = $created_by_field->getSetFunctionName();
             $this->ar->{$set_created_by_function}($ilUser->getId());
         }
         $creation_date_field = $this->getFields()->getCreationDateField();
         if ($creation_date_field) {
             $set_creation_date_function = $creation_date_field->getSetFunctionName();
             $datetime = new ilDateTime(time(), IL_CAL_UNIX);
             $this->ar->{$set_creation_date_function}($datetime);
         }
         $this->ar->create();
     }
     return $this->afterSave();
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:44,代码来源:class.arEditGUI.php

示例6: create

 public function create()
 {
     global $ilUser;
     $this->setOwner($ilUser->getId());
     $this->setUpdateDate(time());
     $this->setCreateDate(time());
     parent::create();
 }
开发者ID:JKN-INC,项目名称:UserDefaults,代码行数:8,代码来源:class.ilUDFCheck.php

示例7: create

 public function create()
 {
     global $ilUser;
     $this->setOwner($ilUser->getId());
     $this->setUpdateDate(time());
     $this->setCreateDate(time());
     if (!$this->hasChecks()) {
         $this->setStatus(self::STATUS_INACTIVE);
     }
     parent::create();
 }
开发者ID:JKN-INC,项目名称:UserDefaults,代码行数:11,代码来源:class.ilUserSetting.php

示例8: setUp

 public function setUp()
 {
     $this->installAndIncludeModels(array('Picture', 'Thumbnail'));
     $Picture = $this->Picture->create(array('title' => 'This is not a picture'));
     $Picture->main_thumbnail->create(array('caption' => 'It cant have a thumbnail'));
 }
开发者ID:bermi,项目名称:akelos,代码行数:6,代码来源:has_one_cascading_destroy.php

示例9: create

 public function create()
 {
     parent::create();
     $this->createDefaultSettings();
 }
开发者ID:studer-raimann,项目名称:Certificate,代码行数:5,代码来源:class.srCertificateType.php

示例10: create

 /**
  * Create certificate
  * Before calling parent::create(), the valid_from and valid_to are are calculated based on the chosen validity in the definition
  * If there exists already a certificate for the given definition and user, the version is increased
  *
  * @throws Exception
  */
 public function create()
 {
     if (is_null($this->getDefinition()) || !$this->getUserId()) {
         throw new Exception("srCertificate::create() must have valid Definition and User-ID");
     }
     // Set validity dates
     $valid_from = date("Y-m-d");
     $valid_to = $this->calculateValidTo();
     $this->setValidFrom($valid_from);
     $this->setValidTo($valid_to);
     // Check if we need to increase the version if a certificate for same user & definition already exists
     /** @var srCertificate $cert_last_version */
     $certs = srCertificate::where(array('definition_id' => $this->getDefinitionId(), 'user_id' => $this->getUserId()))->orderBy('file_version', 'DESC');
     $cert_last_version = $certs->first();
     if (!is_null($cert_last_version)) {
         $this->setFileVersion((int) $cert_last_version->getFileVersion() + 1);
     }
     // Remove active flag from other versions of this certificate
     /** @var srCertificate $cert */
     foreach ($certs->get() as $cert) {
         $cert->setActive(false);
         $cert->save();
     }
     // Set active flag
     $this->setActive(true);
     // Set the filename for certificate
     $this->filename = $this->createFilename();
     $this->created_at = date('Y-m-d H:i:s');
     parent::create();
     $this->event_handler->raise('Certificate/srCertificate', 'create', array('object' => $this));
 }
开发者ID:studer-raimann,项目名称:Certificate,代码行数:38,代码来源:class.srCertificate.php

示例11: create

 public function create()
 {
     $this->mapToActiveRecord();
     parent::create();
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:5,代码来源:class.arStorage.php


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