Beispiel #1
0
 public function addDetails($parameters)
 {
     $user = new Users();
     $user->setName($parameters['name']);
     $usersDAO = new UsersDAO();
     return $usersDAO->addDetails($user);
 }
Beispiel #2
0
 public function addDetails(Users $user)
 {
     try {
         $connection = $this->getConnection($this->dbnode);
         $query = "INSERT INTO USERS (name, created)\n                VALUES (:name, :created)";
         $statement = $connection->prepare($query);
         $statement->bindValue(':name', $user->getName(), PDO::PARAM_STR);
         $statement->bindValue(':created', date("Y-m-d H:i:s"), PDO::PARAM_STR);
         $statement->execute();
         if ($statement->rowCount() > 0) {
             $return = true;
         } else {
             $return = false;
         }
         $statement->closeCursor();
         return array("status" => $return);
     } catch (PDOException $e) {
         throw new UserEntryFailedException('User Entry Failed', $e);
     } catch (Exception $e) {
         throw new UserEntryFailedException('User Entry Failed', $e);
     }
 }