Exemplo n.º 1
0
 public static function map(\Sb\Db\Model\Model &$user, array $properties, $prefix = "")
 {
     //        var_dump($properties);
     if (array_key_exists('id', $properties)) {
         $user->setId($properties['id']);
     }
     //        if (array_key_exists('wp_id', $properties)) {
     //            $user->setWpId($properties['wp_id']);
     //        }
     if (array_key_exists('facebook_id', $properties)) {
         $user->setFacebookId($properties['facebook_id']);
     }
     if (array_key_exists('connexion_type', $properties)) {
         $user->setConnexionType($properties['connexion_type']);
     }
     if (array_key_exists('first_name', $properties)) {
         $user->setFirstName(stripslashes($properties['first_name']));
     }
     if (array_key_exists('last_name', $properties)) {
         $user->setLastName(stripslashes($properties['last_name']));
     }
     if (array_key_exists('user_name', $properties)) {
         $user->setUserName(stripslashes($properties['user_name']));
     }
     if (array_key_exists('email', $properties)) {
         $user->setEmail($properties['email']);
     }
     if (array_key_exists('password', $properties)) {
         if (!empty($properties['password'])) {
             $user->setPassword(sha1($properties['password']));
         }
     }
     if (array_key_exists('gender', $properties)) {
         $user->setGender($properties['gender']);
     }
     if (array_key_exists('address', $properties)) {
         $user->setAddress($properties['address']);
     }
     if (array_key_exists('city', $properties)) {
         $user->setCity($properties['city']);
     }
     if (array_key_exists('zipCode', $properties)) {
         $user->setZipCode($properties['zipCode']);
     }
     if (array_key_exists('country', $properties)) {
         $user->setCountry($properties['country']);
     }
     if (array_key_exists('birthday', $properties)) {
         $user->setBirthDay(\Sb\Helpers\DateHelper::createDate($properties['birthDay']));
     }
     if (array_key_exists('facebook_language', $properties)) {
         $user->setFacebookLanguage($properties['facebook_language']);
     }
     if (array_key_exists('language', $properties)) {
         $user->setLanguage($properties['language']);
     }
     if (array_key_exists('token', $properties)) {
         $user->setToken($properties['token']);
     }
     if (array_key_exists('token_facebook', $properties)) {
         $user->setTokenFacebook($properties['token_facebook']);
     }
     if (array_key_exists('TokenFacebook', $properties)) {
         $user->setTokenFacebook($properties['TokenFacebook']);
     }
     if (array_key_exists('activated', $properties)) {
         $user->setActivated($properties['activated']);
     }
     if (array_key_exists('deleted', $properties)) {
         $user->setDeleted($properties['deleted']);
     }
     if (array_key_exists('gravatar', $properties)) {
         $user->setGravatar($properties['gravatar']);
     }
     if (array_key_exists('picture', $properties)) {
         $user->setPicture($properties['picture']);
     }
     if (array_key_exists('picture_big', $properties)) {
         $user->setPictureBig($properties['picture_big']);
     }
     if (array_key_exists('created', $properties)) {
         $user->setCreated(\Sb\Helpers\DateHelper::createDate($properties['created']));
     }
     if (array_key_exists('last_login', $properties)) {
         $user->setLastLogin(\Sb\Helpers\DateHelper::createDate($properties['last_login']));
     }
 }