Skip to content

Commit

Permalink
changed em to entityManager
Browse files Browse the repository at this point in the history
  • Loading branch information
BigAndini committed Jan 2, 2018
1 parent cccb2b6 commit 58fa226
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions module/Admin/src/Admin/Controller/OrderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ public function sendEticketsAction() {
->findOneBy(array('id' => $orderId));


$validStatus = $em->getRepository('ErsBase\Entity\Status')
$validStatus = $entityManager->getRepository('ErsBase\Entity\Status')
->findBy(array('valid' => 1));
$validArray = array_filter($validStatus, function($status) {return $status->getValid();});

Expand Down Expand Up @@ -1077,21 +1077,21 @@ public function changeStatusAction() {
$entityManager = $this->getServiceLocator()
->get('Doctrine\ORM\EntityManager');

$order = $em->getRepository('ErsBase\Entity\Order')
$order = $entityManager->getRepository('ErsBase\Entity\Order')
->findOneBy(array('id' => $id));

if(!$order) {
throw new \Exception('Unable to find order with id '.$id);
}

$form = new Form\SimpleForm($em);
$form = new Form\SimpleForm($entityManager);

$form->get('submit')->setAttributes(array(
'value' => _('save'),
'class' => 'btn btn-success',
));

$status = $em->getRepository('ErsBase\Entity\Status')
$status = $entityManager->getRepository('ErsBase\Entity\Status')
->findBy(array(), array('position' => 'ASC'));

$statusId = $order->getStatus()->getId();
Expand Down Expand Up @@ -1140,10 +1140,10 @@ public function changeStatusAction() {

if ($form->isValid()) {
$data = $form->getData();
$status = $em->getRepository('ErsBase\Entity\Status')
$status = $entityManager->getRepository('ErsBase\Entity\Status')
->findOneBy(array('id' => $data['status_id']));

$order = $em->getRepository('ErsBase\Entity\Order')
$order = $entityManager->getRepository('ErsBase\Entity\Order')
->findOneBy(array('id' => $data['order_id']));

$statusService = $this->getServiceLocator()
Expand Down Expand Up @@ -1178,14 +1178,14 @@ public function changeCommentAction() {
$entityManager = $this->getServiceLocator()
->get('Doctrine\ORM\EntityManager');

$order = $em->getRepository('ErsBase\Entity\Order')
$order = $entityManager->getRepository('ErsBase\Entity\Order')
->findOneBy(array('id' => $id));

if(!$order) {
throw new \Exception('Unable to find order with id '.$id);
}

$form = new Form\SimpleForm($em);
$form = new Form\SimpleForm($entityManager);

$form->get('submit')->setAttributes(array(
'value' => _('save'),
Expand Down Expand Up @@ -1224,13 +1224,13 @@ public function changeCommentAction() {
if ($form->isValid()) {
$data = $form->getData();

$order = $em->getRepository('ErsBase\Entity\Order')
$order = $entityManager->getRepository('ErsBase\Entity\Order')
->findOneBy(array('id' => $data['order_id']));

$order->setComment($data['comment']);

$em->persist($order);
$em->flush();
$entityManager->persist($order);
$eneityManager->flush();

$this->flashMessenger()->addSuccessMessage('Comment for for order '.$order->getCode()->getValue().' has been saved.');
return $this->redirect()->toRoute('admin/order', array(
Expand Down

0 comments on commit 58fa226

Please sign in to comment.