/** * @param \Orm\Zed\Sales\Persistence\SpySalesOrderAddress $salesOrderAddressEntity * * @return \Orm\Zed\Sales\Persistence\SpySalesOrder */ protected function createSpySalesOrderEntity(SpySalesOrderAddress $salesOrderAddressEntity) { $shipmentMethodEntity = SpyShipmentMethodQuery::create()->findOne(); $customerEntity = $this->createCustomer(); $salesOrderEntity = new SpySalesOrder(); $salesOrderEntity->setCustomer($customerEntity); $salesOrderEntity->setBillingAddress($salesOrderAddressEntity); $salesOrderEntity->setShippingAddress(clone $salesOrderAddressEntity); $salesOrderEntity->setShipmentMethod($shipmentMethodEntity); $salesOrderEntity->setOrderReference('123'); $salesOrderEntity->save(); return $salesOrderEntity; }