1
0
Fork 0
mirror of synced 2024-07-06 23:21:05 +12:00

Add create targets migrations

This commit is contained in:
Bradley Schofield 2024-01-23 10:21:55 +00:00
parent 9edf73fa3c
commit 5d49ac80b4

View file

@ -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;
}