for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Component\Core\Customer;
use Sylius\Component\Core\Model\CustomerInterface;
use Sylius\Component\Core\Model\OrderInterface;
/**
* @author Jan Góralski <[email protected]>
final class CustomerOrderAddressesSaver implements OrderAddressesSaverInterface
{
* @var CustomerAddressAdderInterface
private $addressAdder;
* @param CustomerAddressAdderInterface $addressAdder
public function __construct(CustomerAddressAdderInterface $addressAdder)
$this->addressAdder = $addressAdder;
}
* @param OrderInterface $order
public function saveAddresses(OrderInterface $order)
/** @var CustomerInterface $customer */
$customer = $order->getCustomer();
$shippingAddress = $order->getShippingAddress();
$billingAddress = $order->getBillingAddress();
$this->addressAdder->add($customer, clone $billingAddress);
$this->addressAdder->add($customer, clone $shippingAddress);