示例#1
0
 /**
  * @return array List of fields to update with according values.
  */
 public function getStateToSave()
 {
     $shipping = false;
     if (is_object($this->shippingMethod)) {
         $shipping = $this->shippingMethod->getState();
     }
     $payment = false;
     if (is_object($this->paymentMethod)) {
         $payment = $this->paymentMethod->getId();
     }
     return array('id' => $this->id, 'number' => $this->number, 'updated_at' => $this->updatedAt->getTimestamp(), 'completed_at' => $this->completedAt ? $this->completedAt->getTimestamp() : 0, 'items' => $this->items, 'customer' => serialize($this->customer), 'customer_id' => $this->customer->getId(), 'shipping' => array('method' => $shipping, 'price' => $this->shippingPrice, 'rate' => $this->shippingMethodRate), 'payment' => $payment, 'customer_note' => $this->customerNote, 'total' => $this->total, 'subtotal' => $this->subtotal, 'discount' => $this->discount, 'coupons' => $this->coupons, 'shipping_tax' => $this->shippingTax, 'status' => $this->status, 'update_messages' => $this->updateMessages);
 }
示例#2
0
 /**
  * Adds new method to service.
  *
  * @param Method $method Method to add.
  */
 public function addMethod(Method $method)
 {
     $this->methods[$method->getId()] = $method;
 }