// redirect Utils::redirect('list'); } elseif (array_key_exists('save', $_POST)) { // for security reasons, do not map the whole $_POST['todo'] //pretending to have values in $_POST //$data = array('first_name' => 'Bob', 'no_of_passengers' => 2); // private $id; // private $date; // private $content; // private $createdBy; // private $modifiedBy; // private $description; // private $nameOfRestaurant; // private $overallRating; // private $restaurant_id; // private $username; // private $status = self::PENDING; $data = array('username' => $_POST['username'], 'email' => $_POST['email'], 'password' => $_POST['password']); // map BlogMemberMapper::map($blogMember, $data); // validate $errors = BlogMemberValidator::validate($blogMember); if (empty($errors)) { // save $blogMemberDao = new BlogMemberDao(); $blogMember = $blogMemberDao->save($blogMember); Flash::addFlash('Thanks for Registering Chipper!'); // redirect Utils::redirect('list', array('status' => 'pending')); } }
/** * Find all {@link FlightBooking}s by search criteria. * @return array array of {@link FlightBooking}s */ public function find($username = null) { $result = array(); $sql = 'SELECT username, password' . ' FROM blog_member' . 'WHERE username = "******";'; // $sql = 'SELECT b.date, b.description, r.restaurant_id, r.name_of_restaurant, r.overall_rating' // . ' FROM blog_posts b, blog_restaurant r ' // . 'WHERE r.restaurant_id = b.restaurant_id AND b.status = "' . $status . '";'; foreach ($this->query($sql) as $row) { $blogMember = new BlogMember(); BlogMemberMapper::map($blogMember, $row); $result[$blogMember->getId()] = $blogMember; } return $result; }