Add create targets migrations
This commit is contained in:
parent
9edf73fa3c
commit
5d49ac80b4
1 changed files with 19 additions and 0 deletions
|
@ -118,6 +118,25 @@ class V20 extends Migration
|
|||
case 'schedules':
|
||||
$document->setAttribute('resourceCollection', 'functions');
|
||||
break;
|
||||
case 'users':
|
||||
if ($document->getAttribute('email', '') !== '') {
|
||||
$document->setAttribute('targets', [
|
||||
'userId' => $document->getId(),
|
||||
'userInternalId' => $document->getInternalId(),
|
||||
'providerType' => MESSAGE_TYPE_EMAIL,
|
||||
'identifier' => $document->getAttribute('email'),
|
||||
]);
|
||||
}
|
||||
|
||||
if ($document->getAttribute('phone', '') !== '') {
|
||||
$document->setAttribute('targets', [
|
||||
'userId' => $document->getId(),
|
||||
'userInternalId' => $document->getInternalId(),
|
||||
'providerType' => MESSAGE_TYPE_SMS,
|
||||
'identifier' => $document->getAttribute('phone'),
|
||||
]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return $document;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue