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


PHP ORM\Behavior类代码示例

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


在下文中一共展示了Behavior类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: __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

示例6: __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

示例7: __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

示例8: __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

示例9: __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

示例10: __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

示例11: 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

示例12: 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

示例13: implementedEvents

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

示例14: __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

示例15: __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


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