/**
  * Subscribe member
  *
  * @param Member $member
  *
  * @throws \Exception
  */
 public function subscribe(Member $member)
 {
     $attributes = array();
     $supportedValues = array_merge(EnumMemberField::getSupportedValues(), EnumMemberCustomField::getSupportedValues());
     foreach ($supportedValues as $fieldName) {
         $getter = 'get' . StringToPascalCase::convert(strtolower($fieldName));
         if (!method_exists($member, $getter)) {
             throw new \Exception('Call to undefined method : \'' . $getter . '\'()');
         }
         $value = $member->{$getter}();
         if (in_array($fieldName, EnumMemberField::getMandatoryValues()) && null === $value) {
             throw new \Exception('Value cannot be null. Parameter name: ' . $fieldName);
         }
         if ($value instanceof \DateTime) {
             $value = $value->format('Y-m-d H:i:s');
         }
         $attributes[$fieldName] = $value;
     }
     $this->service->create_update_user(array('email' => $member->getEmail(), 'attributes' => $attributes, 'blacklisted' => 0, 'listid' => array(), 'listid_unlink' => array(), 'blacklisted_sms' => 0));
 }
 /**
  * Subscribe member
  *
  * @param Member $member
  *
  * @throws \Exception
  */
 public function subscribe(Member $member)
 {
     $data = array();
     $supportedValues = array_merge(EnumMemberField::getSupportedValues(), EnumMemberCustomField::getSupportedValues());
     foreach ($supportedValues as $fieldName) {
         $getter = 'get' . StringToPascalCase::convert(strtolower($fieldName));
         if (!method_exists($member, $getter)) {
             throw new \Exception('Call to undefined method : \'' . $getter . '\'()');
         }
         $value = $member->{$getter}();
         if (in_array($fieldName, EnumMemberField::getMandatoryValues()) && null === $value) {
             throw new \Exception('Value cannot be null. Parameter name: ' . $fieldName);
         }
         if ($value instanceof \DateTime) {
             $value = $value->format('Y-m-d H:i:s');
         }
         $data[$fieldName] = $value;
     }
     $this->service->insertOrUpdateMemberByObj($data, $member->getEmail());
 }