public function initialize(array $config = [])
 {
     parent::initialize($config);
     if (isset($config['states']) && is_array($config['states'])) {
         $this->config('states', $config['states'], false);
     }
 }
 /**
  * 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);
 }
 /**
  * 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');
 }
 /**
  * Constructor hook method.
  *
  * @param array $config The configuration settings provided to this behavior.
  * @return void
  */
 public function initialize(array $config)
 {
     // Set default translations
     $this->config('translations', ['id' => __d('model_history', 'field.id'), 'comment' => __d('model_history', 'field.comment'), 'created' => __d('model_history', 'field.created'), 'modified' => __d('model_history', 'field.modified')]);
     $this->ModelHistory = TableRegistry::get('ModelHistory.ModelHistory');
     // Dynamically attach the hasMany relationship
     $this->_table->hasMany('ModelHistory.ModelHistory', ['conditions' => ['ModelHistory.model' => $this->_table->registryAlias()], 'order' => ['ModelHistory.revision DESC'], 'foreignKey' => 'foreign_key', 'dependent' => false]);
     parent::initialize($config);
 }
 /**
  * Initialize hook
  *
  * @param array $config The config for this behavior.
  * @return void
  * @throws \RuntimeException
  */
 public function initialize(array $config)
 {
     $expected = 'Postgres\\Database\\Driver\\Postgres';
     if (!is_a($this->_table->connection()->driver(), $expected)) {
         $msgstr = sprintf('Driver for table "%s" is not an instance of "%s" (using "%s" connection)', $this->_table->table(), $expected, $this->_table->connection()->configName());
         throw new \RuntimeException($msgstr);
     }
     parent::initialize($config);
     $this->config($config);
 }
 public function initialize(array $config)
 {
     parent::initialize($config);
     if (array_key_exists('private', $config)) {
         $this->upload_private = $config['private'];
     }
     if (array_key_exists('encrypted', $config)) {
         $this->upload_encrypted = $config['encrypted'];
     }
     if (array_key_exists('fields', $config)) {
         $this->upload_fields = $config['fields'];
     }
 }
Ejemplo n.º 7
0
 public function initialize(array $config)
 {
     parent::initialize($config);
     if (isset($config['fields'])) {
         $result = [];
         foreach ((array) $config['fields'] as $field => $when) {
             if (is_int($field)) {
                 $field = $when;
                 $when = 'new';
             }
             $result[$field] = $when;
         }
         $this->config('fields', $result, false);
     }
 }
Ejemplo n.º 8
0
 /**
  * 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)
 {
     parent::initialize($config);
     $habtm = $this->config('habtm');
     /*
      * Ensure that no HABTM models which are already auditable
      * snuck into the settings array. That would be bad. Same for
      * any model which isn't a HABTM association.
      */
     foreach ($habtm as $index => $modelName) {
         $association = $this->_table->association($modelName);
         if (!$association instanceof \Cake\ORM\Association\BelongsToMany) {
             continue;
         }
         if ($this->_table->{$modelName}->hasBehavior('Auditable')) {
             unset($habtm[$index]);
         }
     }
     $this->config('habtm', $habtm, false);
 }
 /**
  * Initializes the behavior and its parent
  *
  * @param array $config Array of configuration settings
  */
 public function initialize(array $config)
 {
     parent::initialize($config);
     // TODO: Change the autogenerated stub
 }
Ejemplo n.º 10
0
 /**
  * Initialize behavior
  *
  * @param array $config Config
  * @return void
  */
 public function initialize(array $config)
 {
     parent::initialize($config);
     $this->_normalizeConfig($config);
 }
 public function initialize(array $config)
 {
     parent::initialize($config);
     $this->_table->hasMany('Revisions', ['className' => 'Revisions.Revisions', 'foreignKey' => 'ref_id', 'order' => 'Revisions.created DESC', 'conditions' => ['ref' => $this->_table->alias()]]);
 }
Ejemplo n.º 12
0
 /**
  * Initialize method
  *
  * @param array $config The configuration for the Table.
  * @return void
  */
 public function initialize(array $config)
 {
     parent::initialize($config);
     $this->foreignKey = Inflector::singularize($this->_table->table()) . '_id';
     $this->_table->hasMany('Historics', ['foreignKey' => $this->foreignKey, 'conditions' => ['Historics.is_active' => true], 'className' => $this->config()['class']]);
 }
Ejemplo n.º 13
0
 /**
  * Initialize
  *
  * Initialize callback for Behaviors.
  *
  * @param array $config Options.
  * @return void
  */
 public function initialize(array $config)
 {
     parent::initialize($config);
 }