/**
* 受注再編集用フォーム作成.
*
* @param Order $Order
* @return array
*/
public function createFormDataForEdit(Order $Order)
{
//受注アイテム
$orderDetail = array();
$OrderDetailColl = $Order->getOrderDetails();
foreach ($OrderDetailColl as $OrderDetail) {
$orderDetail[] = array('Product' => $OrderDetail->getProduct()->getId(), 'ProductClass' => $OrderDetail->getProductClass()->getId(), 'price' => $OrderDetail->getPrice(), 'quantity' => $OrderDetail->getQuantity(), 'tax_rate' => $OrderDetail->getTaxRate(), 'tax_rule' => $OrderDetail->getTaxRule());
}
//受注お届け
$shippings = array();
$ShippingsColl = $Order->getShippings();
foreach ($ShippingsColl as $Shippings) {
$deliveryTime = '';
if (is_object($Shippings->getDeliveryTime())) {
$deliveryTime = $Shippings->getDeliveryTime()->getId();
}
$shippingDeliveryDate = array('year' => null, 'month' => null, 'day' => null);
if ($Shippings->getShippingDeliveryDate() instanceof \DateTime) {
$shippingDeliveryDate['year'] = $Shippings->getShippingDeliveryDate()->format('Y');
$shippingDeliveryDate['month'] = $Shippings->getShippingDeliveryDate()->format('m');
$shippingDeliveryDate['day'] = $Shippings->getShippingDeliveryDate()->format('d');
}
$shippings[] = array('name' => array('name01' => $Shippings->getName01(), 'name02' => $Shippings->getName02()), 'kana' => array('kana01' => $Shippings->getKana01(), 'kana02' => $Shippings->getKana02()), 'company_name' => $Shippings->getCompanyName(), 'zip' => array('zip01' => $Shippings->getZip01(), 'zip02' => $Shippings->getZip02()), 'address' => array('pref' => $Shippings->getPref()->getId(), 'addr01' => $Shippings->getAddr01(), 'addr02' => $Shippings->getAddr02()), 'tel' => array('tel01' => $Shippings->getTel01(), 'tel02' => $Shippings->getTel02(), 'tel03' => $Shippings->getTel03()), 'fax' => array('fax01' => $Shippings->getFax01(), 'fax02' => $Shippings->getFax02(), 'fax03' => $Shippings->getFax03()), 'Delivery' => $Shippings->getDelivery()->getId(), 'DeliveryTime' => $deliveryTime, 'shipping_delivery_date' => $shippingDeliveryDate);
}
$Customer = $Order->getCustomer();
$customer_id = null;
if (is_object($Customer)) {
$customer_id = $Customer->getId();
}
//受注フォーム
$order = array('_token' => 'dummy', 'OrderStatus' => (string) $Order->getOrderStatus(), 'Customer' => (string) $customer_id, 'name' => array('name01' => $Order->getName01(), 'name02' => $Order->getName02()), 'kana' => array('kana01' => $Order->getKana01(), 'kana02' => $Order->getKana02()), 'zip' => array('zip01' => $Order->getZip01(), 'zip02' => $Order->getZip02()), 'address' => array('pref' => $Order->getPref()->getId(), 'addr01' => $Order->getAddr01(), 'addr02' => $Order->getAddr02()), 'email' => $Order->getEmail(), 'tel' => array('tel01' => $Order->getTel01(), 'tel02' => $Order->getTel02(), 'tel03' => $Order->getTel03()), 'fax' => array('fax01' => $Order->getFax01(), 'fax02' => $Order->getFax02(), 'fax03' => $Order->getFax03()), 'company_name' => $Order->getCompanyName(), 'message' => $Order->getMessage(), 'OrderDetails' => $orderDetail, 'discount' => $Order->getDiscount(), 'delivery_fee_total' => $Order->getDeliveryFeeTotal(), 'charge' => $Order->getCharge(), 'Payment' => $Order->getPayment()->getId(), 'Shippings' => $shippings, 'note' => $Order->getNote());
return $order;
}