/** * {@inheritDoc} */ public function load(ObjectManager $manager) { $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(); }
/** * @return \WellCommerce\AppBundle\Entity\PaymentMethodInterface */ public function create() { $paymentMethod = new PaymentMethod(); $paymentMethod->setHierarchy(0); $paymentMethod->setEnabled(true); $paymentMethod->setConfiguration(new ArrayCollection()); $paymentMethod->setShippingMethods(new ArrayCollection()); return $paymentMethod; }