/** * Find all {@link FlightBooking}s by search criteria. * @return array array of {@link FlightBooking}s */ public function find($status = null) { $result = array(); $sql = 'SELECT b.blog_id, b.date, b.description, b.created_by, r.restaurant_id, r.name_of_restaurant, r.overall_rating, m.username' . ' FROM blog_posts b, blog_restaurant r, blog_member m ' . 'WHERE r.restaurant_id = b.restaurant_id AND m.username = b.created_by AND b.status = "' . $status . '";'; // $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) { $blogPost = new BlogPost(); BlogPostMapper::map($blogPost, $row); $result[$blogPost->getId()] = $blogPost; } return $result; }
/** * Find all {@link FlightBooking}s by search criteria. * @return array array of {@link FlightBooking}s */ public function find($status = null) { $result = array(); $sql = 'SELECT blog_id, date FROM blog_posts WHERE ' . 'status = "' . $status . '";'; foreach ($this->query($sql) as $row) { $blogPost = new SimpleBlogPost(); BlogPostMapper::map($blogPost, $row); $result[$blogPost->getId()] = $blogPost; } return $result; }