/**
  * Get {@link FlightBooking} by the identifier 'id' found in the URL.
  * @return FlightBooking {@link FlightBooking} instance
  * @throws NotFoundException if the param or {@link FlightBooking} instance is not found
  */
 public static function getFoodOrderByGetId()
 {
     $orderId = null;
     try {
         $orderId = self::getUrlParam('id');
     } catch (Exception $ex) {
         throw new NotFoundException('No FoodOrder identifier provided.');
     }
     if (!is_numeric($orderId)) {
         throw new NotFoundException('Invalid FoodOrder identifier provided.');
     }
     $dao = new FoodOrderDao();
     $foodOrder = $dao->findByOrderId($orderId);
     if ($foodOrder === null) {
         throw new NotFoundException('Unknown FoodOrder identifier provided.');
     }
     return $foodOrder;
 }
    $foodOrder->setEmail($email);
    $foodOrder->setProductId($product_id);
    //set default status
    $foodOrder->setStatus('PENDING');
    //$foodOrder -> setPickupTime($pickup_time);
    $foodOrder->setDate(date("Y-m-d H:i:s"));
    $status = '';
    if (isset($_POST['food_order']['status'])) {
        $status = filter_var($_POST['food_order']['status'], FILTER_SANITIZE_STRING);
    } else {
        $status = 'PENDING';
    }
    $data = array('product_id' => $_POST['food_order']['order_list'], 'user_id' => 1, 'full_name' => 'Bob Smith', 'email' => '*****@*****.**', 'phone_number' => '0278839406', 'date' => date("Y-m-d H:i:s"), 'status' => $status);
    // var_dump($_POST);
    // die();
    // map
    FoodOrderMapper::map($foodOrder, $data);
    // validate
    //   $errors = FoodOrderValidator::validate($foodOrder);
    //   if (empty($errors)) {
    // save
    $dao = new FoodOrderDao();
    $foodOrder = $dao->save($foodOrder);
    Flash::addFlash('Thank you for ordering with us.');
    // redirect
    Utils::redirect('home');
    //   }
}
$productDao = new ProductDao();
$product_id = Utils::getUrlParam('product_id');
$products = $productDao->find();
<?php

//order list script
//$status = Utils::getUrlParam('status');
//TodoValidator::validateStatus($status);
//
$dao = new FoodOrderDao();
// data for template
$title = 'Orders';
$foodOrders = $dao->find();