Announcement

Collapse
No announcement yet.

Helper methods for phoneNumberData and emailAddressData manipulation

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Helper methods for phoneNumberData and emailAddressData manipulation

    I believe this area is one of the most re-implemented and more error prone aspects of espocrm entity management. It would greatly improve productivity to already have these helper methods properly implemented in core. For example:
    Code:
    function addPhoneNumber($entity, $number, $primary, $invalid, $optout): bool
    function removePhoneNumber($entity, $number): bool
    function setPrimaryPhoneNumber($entity, $number): bool
    
    function addEmailAddress($entity, $address, $primary, $invalid, $optout): bool
    function removeEmailAddress($entity, $number): bool
    function setPrimaryEmailAddress($entity, $number): bool
    Last edited by tothewine; 06-29-2020, 11:28 PM.

  • #2
    Another idea also is to implement helper functions in PhoneNumber core class itself like this
    Code:
    class PhoneNumber {
       public function addTo(Entity $entity) : bool
       public function removeFrom(Entity $entity) : bool
       public function setPrimary(Entity $entity, bool $value) : bool
       public static function loadNumber(string $number) : ?PhoneNumber
    }
    Last edited by tothewine; 06-30-2020, 11:13 AM.

    Comment

    Working...
    X