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


PHP ActiveRecord::attachBehavior方法代码示例

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


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

示例1: testRenderDualNotController

 /**
  * @test
  */
 public function testRenderDualNotController()
 {
     $controller = new \yii\db\ActiveRecord();
     $controller->attachBehavior('RenderDual', new \yii2renderdual\RenderDual());
     $this->setExpectedException('Exception');
     $render = $controller->renderDual('view', ['foo' => 'bar'], 'foo bar');
 }
开发者ID:felixmaier1989,项目名称:yii2-renderdual,代码行数:10,代码来源:RenderDualTest.php

示例2: setUp

 public function setUp()
 {
     $this->mock = $this->getMock(ActiveRecord::class, ['save', 'hasAttribute', 'getIsNewRecord', 'setAttribute']);
     $this->mock->attachBehavior('bl', ['class' => BlameableBehavior::class]);
 }
开发者ID:opus-online,项目名称:yii2-base,代码行数:5,代码来源:BlameableBehaviorTest.php

示例3: setUp

 public function setUp()
 {
     $this->mock = $this->getMock(ActiveRecord::class, ['save', 'hasAttribute', 'getIsNewRecord', 'setAttribute']);
     $this->mock->attachBehavior('ts', ['class' => TimestampBehavior::class, 'createdAtAttribute' => 'cr', 'updatedAtAttribute' => 'up']);
 }
开发者ID:opus-online,项目名称:yii2-base,代码行数:5,代码来源:TimestampBehaviorTest.php

示例4: sendSigned

 /**
  * Send currently signed emails.
  */
 protected function sendSigned()
 {
     while ($fetchedMails = $this->findMailBySignature($this->pageSize)) {
         foreach ($fetchedMails as $this->_fetchedMail) {
             if ($this->sentByBehavior) {
                 $this->_fetchedMail->attachBehavior($this->sentByBehavior->className(), $this->sentByBehavior);
             }
             $msg = $this->assembleMailMessage($this->_fetchedMail);
             $isSent = $this->testMode ? rand(0, 1) : $this->getMailer()->send($msg);
             $this->processEmailStatus($this->_fetchedMail, $isSent);
             $this->_fetchedMail->save(false);
             $this->{$this->useLiteAntiSpams ? "applySpamRulesLite" : "applySpamRules"}(++$this->_sentCount);
         }
     }
 }
开发者ID:thinker-g,项目名称:yii2-hermes-mailing,代码行数:18,代码来源:DefaultController.php

示例5: attachBehaviorsToModel

 public function attachBehaviorsToModel(ActiveRecord $model)
 {
     $model->attachBehavior('datetimepicker', \vladdnepr\ycm\behaviors\DatePickerBehavior::className());
     $model->attachBehavior('relationsseter', \vladdnepr\ycm\behaviors\RelationsBehavior::className());
     $model->attachBehavior('multilang', \vladdnepr\ycm\behaviors\MultilangBehavior::className());
     return $model;
 }
开发者ID:vladdnepr,项目名称:yii2-ycm,代码行数:7,代码来源:Module.php

示例6: setUp

 public function setUp()
 {
     $this->mock = $this->getMock(ActiveRecord::class, ['save', 'validate']);
     $this->mock->attachBehavior('safeSaver', SafeSaverBehaviour::class);
 }
开发者ID:opus-online,项目名称:yii2-base,代码行数:5,代码来源:SafeSaverBehaviourTest.php


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