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


PHP Behavior::__construct方法代码示例

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


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

示例1: __construct

 /**
  * Constructor
  *
  * @param \Cake\ORM\Table $table Table who requested the behavior.
  * @param array $config Options.
  */
 public function __construct(Table $table, array $config = [])
 {
     parent::__construct($table, $config);
     $this->Table = $table;
     if ($this->config('created_by')) {
         $this->Table->belongsTo('CreatedBy', ['foreignKey' => $this->config('created_by'), 'className' => $this->config('userModel'), 'propertyName' => $this->config('createdByPropertyName')]);
     }
     if ($this->config('modified_by')) {
         $this->Table->belongsTo('ModifiedBy', ['foreignKey' => $this->config('modified_by'), 'className' => $this->config('userModel'), 'propertyName' => $this->config('modifiedByPropertyName')]);
     }
 }
开发者ID:Tomicapo,项目名称:cakephp-utils,代码行数:17,代码来源:WhoDidItBehavior.php

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

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

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

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

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

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

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

 /**
  * 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

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

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

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

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

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

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


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