https://docs.espocrm.com/development...#value-objects
Hi,
i try .. but no luck (certainly because my english)
how i can "insert" phoneNumber in back-end
i have try many .. no luck
nothing is saved in entity
Hi,
i try .. but no luck (certainly because my english)
how i can "insert" phoneNumber in back-end
i have try many .. no luck
nothing is saved in entity
HTML Code:
$group = $entity->getPhoneNumberGroup(); if ($data->phone_office && !$group->hasNumber($data->phone_office)) { $phone = PhoneNumber::create($data->phone_office); $phone->withType('Office'); $group->withAdded($phone); }elseif($data->phone_alternate && !$group->hasNumber($data->phone_alternate)) { $phone = PhoneNumber::create($data->phone_alternate); $phone->withType('Home'); $group->withAdded($phone); }elseif($data->dio_phone_mobile && !$group->hasNumber($data->dio_phone_mobile)) { $phone = PhoneNumber::create($data->dio_phone_mobile); $phone->withType('Mobile'); $group->withAdded($phone); } $valueMap = (new PhoneNumberGroupAttributeExtractor())->extract($group, 'phoneNumberData'); $GLOBALS['log']->warning('valueMap => ' .json_encode( $valueMap )); $GLOBALS['log']->warning('group => ' .json_encode( $group )); $GLOBALS['log']->warning('phone => ' .json_encode( $phone )); //$entity->setPhoneNumberGroup($group); //$entity->setValueObject($group); $GLOBALS['log']->warning('group => ' .json_encode( $phoneNumberData )); $entity->setPhoneNumberGroup($phoneNumberData); $em->saveEntity($entity, $options);
Comment