예제 #1
0
 /**
  * @param \Orm\Zed\Customer\Persistence\SpyCustomerAddress $addressEntity
  *
  * @return \Generated\Shared\Transfer\AddressTransfer
  */
 protected function entityToTransfer(SpyCustomerAddress $addressEntity)
 {
     $addressTransfer = new AddressTransfer();
     $addressTransfer->fromArray($addressEntity->toArray(), true);
     $addressTransfer->setIso2Code($addressEntity->getCountry()->getIso2Code());
     return $addressTransfer;
 }
예제 #2
0
 /**
  * @param \Generated\Shared\Transfer\AddressTransfer $addressTransfer
  * @param \Orm\Zed\Customer\Persistence\SpyCustomer $customer
  *
  * @return \Orm\Zed\Customer\Persistence\SpyCustomerAddress
  */
 protected function createCustomerAddress(AddressTransfer $addressTransfer, SpyCustomer $customer)
 {
     $addressEntity = new SpyCustomerAddress();
     $addressEntity->fromArray($addressTransfer->toArray());
     $fkCountry = $this->retrieveFkCountry($addressTransfer);
     $addressEntity->setFkCountry($fkCountry);
     $addressEntity->setCustomer($customer);
     $addressEntity->save();
     return $addressEntity;
 }