WellCommerce\Bundle\PaymentBundle\Entity\PaymentMethod::setShippingMethods PHP Method

setShippingMethods() public method

public setShippingMethods ( Doctrine\Common\Collections\Collection $shippingMethods )
$shippingMethods Doctrine\Common\Collections\Collection
    public function setShippingMethods(Collection $shippingMethods)
    {
        $this->shippingMethods = $shippingMethods;
    }

Usage Example

コード例 #1
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     if (!$this->isEnabled()) {
         return;
     }
     $shippingMethods = new ArrayCollection();
     $shippingMethods->add($this->getReference('shipping_method_fedex'));
     $shippingMethods->add($this->getReference('shipping_method_ups'));
     $cod = new PaymentMethod();
     $cod->setEnabled(1);
     $cod->setHierarchy(0);
     $cod->setProcessor('cod');
     $cod->translate('en')->setName('Cash on delivery');
     $cod->setShippingMethods($shippingMethods);
     $cod->setDefaultOrderStatus($this->getReference('default_order_status'));
     $cod->mergeNewTranslations();
     $manager->persist($cod);
     $bankTransfer = new PaymentMethod();
     $bankTransfer->setEnabled(1);
     $bankTransfer->setHierarchy(0);
     $bankTransfer->setProcessor('bank_transfer');
     $bankTransfer->translate('en')->setName('Bank transfer');
     $bankTransfer->setShippingMethods($shippingMethods);
     $bankTransfer->setDefaultOrderStatus($this->getReference('default_order_status'));
     $bankTransfer->mergeNewTranslations();
     $manager->persist($bankTransfer);
     $manager->flush();
     $this->setReference('payment_method_cod', $cod);
     $this->setReference('payment_method_bank_transfer', $bankTransfer);
 }
All Usage Examples Of WellCommerce\Bundle\PaymentBundle\Entity\PaymentMethod::setShippingMethods