Exemplo n.º 1
0
 public static function map(Advice $advice, array $properties)
 {
     if (array_key_exists('adviceId', $properties)) {
         $advice->setAdviceId($properties['adviceId']);
     }
     if (array_key_exists('content', $properties)) {
         $advice->setContent($properties['content']);
     }
     if (array_key_exists('createdBy', $properties)) {
         $advice->setCreatedBy($properties['createdBy']);
     }
     if (array_key_exists('createdAt', $properties)) {
         $createdAt = DateTransform::createDateTime($properties['createdAt']);
         if ($createdAt) {
             $advice->setCreatedAt($createdAt);
         }
     }
 }
Exemplo n.º 2
0
 public static function map(User $user, array $properties)
 {
     if (array_key_exists('userId', $properties)) {
         $user->setUserId($properties['userId']);
     }
     if (array_key_exists('password', $properties)) {
         $user->setPassword($properties['password']);
     }
     if (array_key_exists('name', $properties)) {
         $user->setName($properties['name']);
     }
     if (array_key_exists('gender', $properties)) {
         $user->setGender($properties['gender']);
     }
     if (array_key_exists('telephone', $properties)) {
         $user->setTelephone($properties['telephone']);
     }
     if (array_key_exists('email', $properties)) {
         $user->setEmail($properties['email']);
     }
     if (array_key_exists('avatar', $properties)) {
         $user->setAvatar($properties['avatar']);
     }
     if (array_key_exists('slogan', $properties)) {
         $user->setSlogan($properties['slogan']);
     }
     if (array_key_exists('birthday', $properties)) {
         $user->setBirthday($properties['birthday']);
     }
     if (array_key_exists('createdAt', $properties)) {
         $tempCreatedAt = DateTransform::createDate($properties['createdAt']);
         if ($tempCreatedAt) {
             $user->setCreatedAt($tempCreatedAt);
         }
     }
     if (array_key_exists('character', $properties)) {
         $user->setCharacter($properties['character']);
     }
 }