Example #1
0
 /**
  * Set PaymentType entity (many to one).
  *
  * @param \Entity\PaymentType $paymentType
  * @return \Entity\Order
  */
 public function setPaymentType(PaymentType $paymentType = null)
 {
     $this->paymentType = $paymentType;
     if ($paymentType) {
         $this->setPaymentTypeId($paymentType->getId());
     }
     return $this;
 }
Example #2
0
 public function addAction()
 {
     $form = new Form\PaymentType();
     $form->get('submit')->setValue('Add');
     $request = $this->getRequest();
     if ($request->isPost()) {
         $paymenttype = new Entity\PaymentType();
         #$form->setInputFilter($paymenttype->getInputFilter());
         $form->setData($request->getPost());
         if ($form->isValid()) {
             $paymenttype->populate($form->getData());
             $em = $this->getServiceLocator()->get('Doctrine\\ORM\\EntityManager');
             $em->persist($paymenttype);
             $em->flush();
             return $this->redirect()->toRoute('admin/payment-type');
         } else {
             $logger = $this->getServiceLocator()->get('Logger');
             $logger->warn($form->getMessages());
         }
     }
     return new ViewModel(array('form' => $form));
 }