I am little confused by the Value Objects explanations on this page:
The example for Email Address and Phone Number value objects shows this:
I have a custom entity ('MyEntity') with this in its entityDefs:
But I get an error if I try to this:
Also, how do I add a phone number to a new record for this entity?
The example for Email Address and Phone Number value objects shows this:
PHP Code:
<?php
$emailAddressGroup = $accountEntity->getEmailAddressGroup();
$primary = $emailAddressGroup->getPrimary();
$modifiedEmailAddressGroup = $emailAddressGroup
->withAddedEmailAddress(
EmailAddress::create('address@test.com')->optedOut()
);
$accountEntity->setEmailAddressGroup($modifiedEmailAddressGroup);
PHP Code:
{
"fields": {
"phoneNumber": {
"notStorable": true,
"type": "phone",
"typeList": [
"Patient",
"Dr. Office",
"Event Location",
"Site Contact"
],
"defaultType": "Patient",
"required": false,
"tooltip": false,
"customMask": "(999) 999-9999"
},
}
}
PHP Code:
$myEntity = $entityManager->getEntityById('myEntity', 'id-string');
$phoneNumberGroup = $myEntity->getPhoneNumberGroup();
Comment