Skip to content

Commit

Permalink
Ability to pass associated models for register
Browse files Browse the repository at this point in the history
  • Loading branch information
yeliparra committed Apr 17, 2019
1 parent f1a70c6 commit e40cb9b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Model/Behavior/RegisterBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,12 @@ public function register($user, $data, $options)
{
$validateEmail = Hash::get($options, 'validate_email');
$tokenExpiration = Hash::get($options, 'token_expiration');
$associated = Configure::read('Users.Registration.associated') ? ['associated' => Configure::read('Users.Registration.associated')] : [];

$user = $this->_table->patchEntity(
$user,
$data,
['validate' => Hash::get($options, 'validator') ?: $this->getRegisterValidators($options)]
array_merge(['validate' => Hash::get($options, 'validator') ?: $this->getRegisterValidators($options)], $associated)
);
$user['role'] = Configure::read('Users.Registration.defaultRole') ?: 'user';
$user->validated = false;
Expand Down

0 comments on commit e40cb9b

Please sign in to comment.