Example #1
0
 /**
  * {@inheritdoc}
  *
  * @param array $config Strategy's configuration.
  * @return $this
  */
 public function initialize($config)
 {
     $config = parent::initialize($config)->config();
     $assocName = Inflector::pluralize(Inflector::classify($this->_alias));
     $this->_table->belongsTo($assocName, ['className' => $this->modelClass, 'foreignKey' => $config['field'], 'bindingKey' => 'name', 'conditions' => [$assocName . '.prefix' => $config['prefix']]]);
     return $this;
 }
Example #2
0
 /**
  * {@inheritdoc}
  *
  * @param string $alias Strategy's alias.
  * @param \Cake\ORM\Table $table Table object.
  */
 public function __construct($alias, Table $table)
 {
     parent::__construct($alias, $table);
     $this->_defaultConfig['prefix'] = strtoupper($alias);
     $this->_defaultConfig['lowercase'] = false;
 }