• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ORM\Behavior类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Cake\ORM\Behavior的典型用法代码示例。如果您正苦于以下问题:PHP Behavior类的具体用法?PHP Behavior怎么用?PHP Behavior使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: __construct

 /**
  * Default configuration.
  *
  * @var array
  *
  */
 public function __construct(Table $table, array $config = [])
 {
     parent::__construct($table, $config);
     $this->_table = $table;
     $this->_table->addBehavior('Timestamp');
     $this->bindTagAssociations();
 }
开发者ID:matthiasmoritz,项目名称:cake-tag,代码行数:13,代码来源:TaggableBehavior.php


示例2: __construct

 /**
  * Constructor
  *
  * If events are specified - do *not* merge them with existing events,
  * overwrite the events to listen on
  *
  * @param \Cake\ORM\Table $table The table this behavior is attached to.
  * @param array $config The config for this behavior.
  */
 public function __construct(Table $table, array $config = [])
 {
     //Merge $config with application-wide scopeBehavior config
     $config = array_merge(MTApp::config('scopeBehavior'), $config);
     parent::__construct($table, $config);
     $this->_table = $table;
 }
开发者ID:pdata,项目名称:multitenant,代码行数:16,代码来源:MixedScopeBehavior.php


示例3: initialize

 /**
  * Behavior configuration
  *
  * @param array $config
  * @return void
  */
 public function initialize(array $config = [])
 {
     $config += (array) Configure::read('Captcha');
     parent::initialize($config);
     $engine = $this->config('engine');
     $this->_engine = new $engine($this->config());
     $this->_captchasTable = TableRegistry::get('Captcha.Captchas');
 }
开发者ID:dereuromark,项目名称:cakephp-captcha,代码行数:14,代码来源:CaptchaBehavior.php


示例4: __construct

 /**
  * Constructor
  *
  * @param \Cake\ORM\Table $table The table this behavior is attached to.
  * @param array $config The settings for this behavior.
  */
 public function __construct(Table $table, array $config = [])
 {
     $this->_defaultConfig = Hash::merge($this->_defaultConfig, (array) Configure::read('FileStorage.Behavior'));
     parent::__construct($table, $config);
     $this->_table = $table;
     if ($this->_config['validate'] === true) {
         $this->configureUploadValidation($this->_config['validator']);
     }
 }
开发者ID:tiagocapelli,项目名称:cakephp-file-storage,代码行数:15,代码来源:UploadValidatorBehavior.php


示例5: verifyConfig

 /**
  * Verify config.
  *
  * @return void
  */
 public function verifyConfig()
 {
     if (!($strategy = $this->config('strategy'))) {
         throw new Exception('Missing required obfuscation strategy.');
     }
     if (!$strategy instanceof StrategyInterface) {
         throw new Exception('Strategy must implement the `Muffin\\Obfuscate\\Model\\Behavior\\Strategy\\StrategyInterface`');
     }
     parent::verifyConfig();
 }
开发者ID:UseMuffin,项目名称:Obfuscate,代码行数:15,代码来源:ObfuscateBehavior.php


示例6: __construct

 /**
  * Constructor
  *
  * @param \Cake\ORM\Table $table The table this behavior is attached to.
  * @param array $config The settings for this behavior.
  */
 public function __construct(Table $table, array $config = [])
 {
     $this->_defaultConfig = Hash::merge($this->_defaultConfig, (array) Configure::read('UserTools.Behavior'));
     parent::__construct($table, $config);
     $this->_table = $table;
     if ($this->_config['defaultValidation'] === true) {
         $this->setupDefaultValidation($this->_table);
     }
     $this->eventManager()->attach($this->_table);
 }
开发者ID:djonatanb,项目名称:cakephp-user-tools,代码行数:16,代码来源:UserBehavior.php


示例7: __construct

 /**
  * Constructor
  *
  * @param Table $table The table this behavior is attached to.
  * @param array $config The config for this behavior.
  */
 public function __construct(Table $table, array $config = [])
 {
     parent::__construct($table, $config);
     $this->_table = $table;
     $config = $this->_config;
     $this->setupFieldAssociations($config['fields'], $config['translationTable']);
 }
开发者ID:ripzappa0924,项目名称:carte0.0.1,代码行数:13,代码来源:TranslateBehavior.php


示例8: __construct

 /**
  * @param \Cake\ORM\Table $table
  * @param array $config
  */
 public function __construct(Table $table, array $config = [])
 {
     parent::__construct($table, $config);
     if (!$this->_config['message']) {
         $this->_config['message'] = __d('tools', 'Please confirm the checkbox');
     }
 }
开发者ID:alescx,项目名称:cakephp-tools,代码行数:11,代码来源:ConfirmableBehavior.php


示例9: __construct

 /**
  * Sets up the configuration for the model, and loads ACL models if they haven't been already
  *
  * @param Table $model Table instance being attached
  * @param array $config Configuration
  * @return void
  */
 public function __construct(Table $model, array $config = [])
 {
     $this->_table = $model;
     if (isset($config[0])) {
         $config['type'] = $config[0];
         unset($config[0]);
     }
     if (isset($config['type'])) {
         $config['type'] = strtolower($config['type']);
     }
     parent::__construct($model, $config);
     $types = $this->_typeMaps[$this->config()['type']];
     if (!is_array($types)) {
         $types = [$types];
     }
     foreach ($types as $type) {
         $alias = Inflector::pluralize($type);
         $className = App::className($alias . 'Table', 'Model/Table');
         if ($className == false) {
             $className = App::className('Acl.' . $alias . 'Table', 'Model/Table');
         }
         $config = [];
         if (!TableRegistry::exists($alias)) {
             $config = ['className' => $className];
         }
         $model->hasMany($type, ['targetTable' => TableRegistry::get($alias, $config)]);
     }
     if (!method_exists($model->entityClass(), 'parentNode')) {
         trigger_error(__d('cake_dev', 'Callback {0} not defined in {1}', ['parentNode()', $model->entityClass()]), E_USER_WARNING);
     }
 }
开发者ID:cakephp,项目名称:acl,代码行数:38,代码来源:AclBehavior.php


示例10: __construct

 /**
  * Constructor
  *
  * @param Table $table The table this behavior is attached to.
  * @param array $settings The settings for this behavior.
  */
 public function __construct(Table $table, array $settings = [])
 {
     parent::__construct($table, $settings);
     $class = '\\Imagine\\' . $this->config('engine') . '\\Imagine';
     $this->Imagine = new $class();
     $this->_table = $table;
 }
开发者ID:e2e4gu,项目名称:adaptive-image-plugin,代码行数:13,代码来源:ImagineBehavior.php


示例11: __construct

 public function __construct(Table $table, array $config = [])
 {
     $this->_defaultConfig['ancestor_table_name'] = $table->schema()->name() . '_ancestors';
     parent::__construct($table, $config);
     $this->_table = $table;
     $this->addValidationRules();
 }
开发者ID:alaxos,项目名称:cakephp3-libs,代码行数:7,代码来源:AncestorBehavior.php


示例12: __construct

 /**
  * Constructor
  *
  * If events are specified - do *not* merge them with existing events,
  * overwrite the events to listen on
  *
  * @param Table $table The table this behavior is attached to.
  * @param array $config The config for this behavior.
  */
 public function __construct(Table $table, array $config = [])
 {
     parent::__construct($table, $config);
     if (isset($config['events'])) {
         $this->config('events', $config['events'], false);
     }
 }
开发者ID:ripzappa0924,项目名称:carte0.0.1,代码行数:16,代码来源:TimestampBehavior.php


示例13: initialize

 public function initialize(array $config = [])
 {
     parent::initialize($config);
     if (isset($config['states']) && is_array($config['states'])) {
         $this->config('states', $config['states'], false);
     }
 }
开发者ID:mindforce,项目名称:cakephp-platform,代码行数:7,代码来源:StateableBehavior.php


示例14: verifyConfig

 public function verifyConfig()
 {
     if ($this->config('implementedMethods') && !$this->config('implementedServices')) {
         throw new Exception('No reviews types defined.');
     }
     parent::verifyConfig();
 }
开发者ID:jadb,项目名称:muffin-reviews,代码行数:7,代码来源:ReviewsBehavior.php


示例15: implementedEvents

 /**
  * イベント設定
  *
  * @access public
  * @author sakuragawa
  */
 public function implementedEvents()
 {
     $events = parent::implementedEvents();
     // buildValidatorを登録
     $events['Model.buildValidator'] = 'buildValidator';
     return $events;
 }
开发者ID:kozo,项目名称:Apollon,代码行数:13,代码来源:ApollonBehavior.php


示例16: __construct

 /**
  * Constructor.
  *
  * @param \Cake\ORM\Table $table The table this behavior is attached to.
  * @param array $config The config for this behavior.
  */
 public function __construct(Table $table, array $config = [])
 {
     if (!empty($config['implementedEvents'])) {
         $this->_defaultConfig['implementedEvents'] = $config['implementedEvents'];
         unset($config['implementedEvents']);
     }
     parent::__construct($table, $config);
 }
开发者ID:hareshpatel1990,项目名称:Slug,代码行数:14,代码来源:SlugBehavior.php


示例17: __construct

 /**
  * Constructor
  *
  * @param \Cake\ORM\Table $table The table this behavior is attached to.
  * @param array $config The config for this behavior.
  */
 public function __construct(Table $table, array $config = [])
 {
     $config += ['defaultLocale' => I18n::defaultLocale(), 'referenceName' => $this->_referenceName($table)];
     if (isset($config['tableLocator'])) {
         $this->_tableLocator = $config['tableLocator'];
     }
     parent::__construct($table, $config);
 }
开发者ID:JesseDarellMoore,项目名称:CS499,代码行数:14,代码来源:TranslateBehavior.php


示例18: initialize

 /**
  * Constructor hook method.
  *
  * Implement this method to avoid having to overwrite
  * the constructor and call parent.
  *
  * @param array $config The configuration settings provided to this behavior.
  * @return void
  */
 public function initialize(array $config)
 {
     $this->Attachments = TableRegistry::get('Attachments.Attachments');
     // Dynamically attach the hasMany relationship
     $this->_table->hasMany('Attachments.Attachments', ['conditions' => ['Attachments.model' => $this->_table->registryAlias()], 'foreignKey' => 'foreign_key', 'dependent' => true]);
     $this->Attachments->belongsTo($this->_table->registryAlias(), ['conditions' => ['Attachments.model' => $this->_table->registryAlias()], 'foreignKey' => 'foreign_key']);
     parent::initialize($config);
 }
开发者ID:cleptric,项目名称:cake-attachments,代码行数:17,代码来源:AttachmentsBehavior.php


示例19: __construct

 /**
  * Adding validation rules
  * also adds and merges config settings (direct + configure)
  *
  * @return void
  */
 public function __construct(Table $table, array $config = [])
 {
     $defaults = $this->_defaultConfig;
     if ($configureDefaults = Configure::read('Reset')) {
         $defaults = $configureDefaults + $defaults;
     }
     $config + $defaults;
     parent::__construct($table, $config);
 }
开发者ID:olmprakash,项目名称:cakephp-tools,代码行数:15,代码来源:ResetBehavior.php


示例20: __construct

 /**
  * Constructor.
  *
  * @param \Cake\ORM\Table $table  The table this behavior is attached to.
  * @param array           $config The config for this behavior.
  */
 public function __construct(Table $table, array $config = [])
 {
     parent::__construct($table, $config);
     $this->_table = $table;
     /**
      * Instance the Folder with the root configuration.
      */
     $this->_folder = new Folder($this->_config['root']);
 }
开发者ID:luizhenriquesoares,项目名称:actuale,代码行数:15,代码来源:UploadBehavior.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ORM\Entity类代码示例发布时间:2022-05-23
下一篇:
PHP ORM\Association类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap