Ejemplo n.º 1
0
 public function updateUser(\Lexicon\Port\Adaptor\Data\Lexicon\User $user)
 {
     $locator = \Lexicon\Infrastructure\Helpers\Locator::getInstance();
     $conn = $locator->locate("DB_CONNECT");
     $handler = $locator->locate("VALIDATION_HANDLER");
     $user->validateType($handler);
     if ($handler->hasErrors()) {
         throw new Exception($handler, $code);
     } else {
         $query = "UPDATE `t_users` SET first_name = ?,gender = ?,last_name = ?,name = ?,email = ?,locale = ?,link = ?,timezone = ?,updated_time = ?,verified = ?,xmlview = ? WHERE id = ?;";
         $params = array($user->getFirstName() ? $user->getFirstName() : "", $user->getGender() ? $user->getGender() : "", $user->getLastName() ? $user->getLastName() : "", $user->getName() ? $user->getName() : "", $user->getEmail() ? $user->getEmail() : "", $user->getLocale() ? $user->getLocale() : "", $user->getLink() ? $user->getLink() : "", $user->getTimezone() ? $user->getTimezone() : "", $user->getUpdatedTime() ? $user->getUpdatedTime() : "", $user->getVerified() ? $user->getVerified() : "", $user->toXmlStr(), $user->getId());
         //print($query);print_r($params);exit;
         $sth = $conn->prepare($query);
         $sth->execute($params);
         return $user;
     }
 }
Ejemplo n.º 2
0
 protected function updateFromFacebookInfo(\Lexicon\Port\Adaptor\Data\Lexicon\User $user, array $info)
 {
     $user->setId($info["id"]);
     if (isset($info["email"])) {
         $user->setEmail($info["email"]);
     }
     if (isset($info["first_name"])) {
         $user->setFirstName($info["first_name"]);
     }
     if (isset($info["gender"])) {
         $user->setGender($info["gender"]);
     }
     if (isset($info["last_name"])) {
         $user->setLastName($info["last_name"]);
     }
     if (isset($info["link"])) {
         $user->setLink($info["link"]);
     }
     if (isset($info["locale"])) {
         $user->setLocale($info["locale"]);
     }
     if (isset($info["name"])) {
         $user->setName($info["name"]);
     }
     if (isset($info["timezone"])) {
         $user->setTimezone($info["timezone"]);
     }
     if (isset($info["updated_time"])) {
         $user->setUpdatedTime($info["updated_time"]);
     }
     if (isset($info["verified"])) {
         $user->setVerified(intval($info["verified"]));
     }
     return $user;
 }