public static function map(FoodOrder $foodOrder, array $properties)
 {
     //        var_dump($properties);
     //        die();
     if (array_key_exists('order_id', $properties)) {
         $foodOrder->setOrderId($properties['order_id']);
     }
     if (array_key_exists('user_id', $properties)) {
         $foodOrder->setUserId($properties['user_id']);
     }
     if (array_key_exists('full_name', $properties)) {
         $foodOrder->setFullName($properties['full_name']);
     }
     if (array_key_exists('email', $properties)) {
         $foodOrder->setEmail($properties['email']);
     }
     if (array_key_exists('product_id', $properties)) {
         $foodOrder->setProductId($properties['product_id']);
     }
     if (array_key_exists('phone_number', $properties)) {
         $foodOrder->setPhoneNumber($properties['phone_number']);
     }
     if (array_key_exists('product_name', $properties)) {
         $foodOrder->setProductName($properties['product_name']);
     }
     if (array_key_exists('date', $properties)) {
         $formattedDate = $properties['date'];
         $date = self::createDateTime($formattedDate);
         if ($date) {
             $foodOrder->setDate($date);
         }
     }
 }
}
if (array_key_exists('cancel', $_POST)) {
    // redirect
    Utils::redirect('home');
} 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);
    //populate with user data
    $user_id = 1;
    //get from session
    // get from DB
    // $full_name = 'Bob Smith';
    //$phone_number = '0278839406';
    //$email = '*****@*****.**';
    $foodOrder->setUserId($user_id);
    $foodOrder->setFullName($full_name);
    $foodOrder->setPhoneNumber($phone_number);
    $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);