/** * Creates a test order. * * @return Order */ public function createNewTestOrder() { // Order $order = new Order(); $order->setNumber('1234'); $order->setCommission('commission'); $order->setCostCentre('cost-centre'); $order->setCustomerName($this->contact->getFullName()); $order->setCurrencyCode($this->defaultCurrencyCode); $order->setTermsOfDelivery($this->termsOfDelivery); $order->setTermsOfDeliveryContent($this->termsOfDelivery->getTerms()); $order->setTermsOfPayment($this->termsOfPayment); $order->setTermsOfPaymentContent($this->termsOfPayment->getTerms()); $order->setCreated(new \DateTime()); $order->setChanged(new \DateTime()); $order->setCreator(); $order->setDesiredDeliveryDate(new \DateTime('2015-01-01')); $order->setSessionId('abcd1234'); $order->setTaxfree(true); $order->setCustomerContact($this->contact); $order->setCustomerAccount($this->account); $order->setStatus($this->orderStatus); $order->setBitmaskStatus($this->orderStatus->getId()); $order->setDeliveryAddress($this->orderAddressDelivery); $order->setInvoiceAddress($this->orderAddressInvoice); $order->setCreator($this->user); $order->setChanger($this->user); $order->setResponsibleContact($this->contact2); $order->setInternalNote('tiny internal note'); $this->em->persist($order); return $order; }
/** * Returns the data needed for the account list-sidebar. * * @param ContactInterface $contact * * @return array */ protected function parseMainContact(ContactInterface $contact) { if ($contact) { $data = []; $data['id'] = $contact->getId(); $data['fullName'] = $contact->getFullName(); $data['phone'] = $contact->getMainPhone(); $data['email'] = $contact->getMainEmail(); return $data; } else { return null; } }
/** * Sets contact data to address data. * * @param array $addressData * @param ContactInterface $contact */ public function mergeContactIntoAddressData(array &$addressData, ContactInterface $contact) { $addressData['firstName'] = $contact->getFirstName(); $addressData['lastName'] = $contact->getLastName(); $addressData['fullName'] = $contact->getFullName(); $addressData['salutation'] = $contact->getSalutation(); $addressData['formOfAddress'] = $contact->getFormOfAddress(); if ($contact->getTitle() !== null) { $addressData['title'] = $contact->getTitle()->getTitle(); } }