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);
         }
     }
 }
<?php

//script of editing the order
$errors = array();
$foodOrder = null;
$edit = array_key_exists('id', $_GET);
if ($edit) {
    $foodOrder = Utils::getFoodOrderByGetId();
} else {
    // set defaults
    $foodOrder = new FoodOrder();
    // $foodOrder ->  setPickupTime( new PickupTime());
    $foodOrder->setDate(new DateTime());
    // get product id from GET
    $product_id = $_GET['product_id'];
    $foodOrder->setProductId($product_id);
    //$flightBooking->setPriority(Todo::PRIORITY_MEDIUM);
    //$dueOn = new DateTime("+1 day");
    //$dueOn->setTime(0, 0, 0);
    //$flightBooking->setDueOn($dueOn);
}
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