Retrieves and shows an order with the given ID

@param \Symfony\Component\HttpFoundation\Request $request
@param integer $id order ID
@return \Symfony\Component\HttpFoundation\Response
967874
public function getAction(Request $request, $id)
    {
        $locale = $this->getLocale($request);
        $view = $this->responseGetById(
            $id,
            function ($id) use ($locale) {
                /** @var Order $order */
                $order = $this->getManager()->findByIdAndLocale($id, $locale);

                // if order was found
                if ($order) {
                    $order->setWorkflows($this->getDependencyManager()->getWorkflows($order));
                }

                return $order;
            }
        );

        return $this->handleView($view);
    }
783275
public function show($id, ShowRequest $request)
    {
        $upload = $this->repository->find($id);
        $upload->load($request->getWith());

        if (empty($upload)) {
            return $this->sendError('Upload not found');
        }

        return $this->sendResponse($upload, '');
    }
874009
public function position(OrderUpdateRequest $request, $id)
    {
        $record  = $this->modelRepository->findOrFail($id);
        $success = false;
        $result  = null;

        if ($this->getModelInformation()->list->orderable) {
            $success = true;
            $result  = $this->changeModelOrderablePosition($record, $request->get('position'));
        }

        if ($success && config('cms-models.notifications.flash.position')) {
            cms_flash(
                cms_trans(
                    'models.store.success-message-position',
                    [ 'record' => $this->getSimpleRecordReference($id, $record) ]
                ),
                FlashLevel::SUCCESS
            );
        }

        event( new Events\ModelPositionUpdatedInCms($record) );

        if (request()->ajax()) {
            return response()->json([ 'success' => $success, 'position' => $result ]);
        }

        return redirect()->back();
    }
1247518
public function fetch($id, Request $request)
    {
        $category = $this->model()->find($id);

        if (is_null($category) || !$category->exists) {
            return $this->notFoundResponse();
        }

        if ($category->private) {
            $this->authorize('view', $category);
        }

        return $this->response($category);
    }
647988
public function show($id, Request $request)
    {
        $entity = $this->getEntityById($id);

        if (!$entity) {
            return $this->response(null, Response::HTTP_NOT_FOUND);
        }

        return $this->response($this->serialize($entity, $request), Response::HTTP_OK);
    }
970255
public function fetch($id, Request $request)
    {
        $thread = $this->model();
        $thread = $request->input('include_deleted') ? $thread->withTrashed()->find($id) : $thread->find($id);

        if (is_null($thread) || !$thread->exists) {
            return $this->notFoundResponse();
        }

        if ($thread->trashed()) {
            $this->authorize('delete', $thread);
        }

        if ($thread->category->private) {
            $this->authorize('view', $thread->category);
        }

        return $this->response($thread);
    }
325478
public function getAction(Request $request, $id)
    {
        $this->checkAccess('GET', $id);
        $resource = $this->getResourceManager()->find($id);
        $view = $this->view($resource, \FOS\RestBundle\Util\Codes::HTTP_OK);
        return $this->handleView($view);
    }
59764
public function show($id,Request $request)
    {
        if($request->ajax())
        {
            return URL::to('setting/'.$id);
        }

        $setting = Setting::findOrfail($id);
        return view('setting.show',compact('setting'));
    }
908874
public function getAction($id, Request $request)
    {
        $includes = explode(',', $request->get('include'));
        $accountManager = $this->getAccountManager();
        $locale = $this->getUser()->getLocale();

        try {
            $view = $this->responseGetById(
                $id,
                function($id) use ($includes, $accountManager, $locale) {
                    return $accountManager->getByIdAndInclude($id, $locale, $includes);
                }
            );

            $context = new Context();
            $context->setGroups(self::$accountSerializationGroups);
            $view->setContext($context);
        } catch (EntityNotFoundException $enfe) {
            $view = $this->view($enfe->toArray(), 404);
        }

        return $this->handleView($view);
    }
54500
public function emailAction(Request $request, $id)
    {
        $em = $this->getDoctrine()->getManager();
        /** @var Newsletter $entity */
        $entity = $em->getRepository('CoreBundle:BaseActor')->find($id);
        
        $form = $this->createForm(ActorEmailType::class, null, array('email' => $entity->getEmail()));
       
        if($request->getMethod() == 'POST'){
            $form->handleRequest($request);

            if ($form->isValid()) {
                //Get params
                $data = $form->getData();
                $email = $data['email'];            
                if($entity->getEmail() == $email){
                    
                    $news = new Newsletter();
                    $news->setTitle($data['subject']);
                    $news->setBody($data['body']);
                    $news->setActive(true);
                    $em->persist($news);
                    
                    $shipping = new NewsletterShipping();
                    $shipping->setNewsletter($news);
                    $shipping->setActor($entity);
                    $shipping->setTotalSent(1);
                    $shipping->setType(NewsletterShipping::TYPE_PERSONAL);
                    $em->persist($shipping);
                    $em->flush();
                    
                    $this->get('core.mailer')->sendActorEmail($email, $data['subject'], $data['body']);
                    
                    //if come from popup
                    if ($request->isXMLHttpRequest()) {         
                        return new JsonResponse(array(
                                    'id' => $shipping->getId()
                                ));
                    }

                    $this->get('session')->getFlashBag()->add('success', 'user.email.created');
                    return $this->redirect($this->generateUrl('core_baseactor_show', array('id' => $entity->getId())));
                }

            }
        }

        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }
1368005
public function showEdit(int $id = null, array $request = [])
    {
        if ($id === null) {
            if (isset($_GET['template']) === false) {
                return redirect($this->router->generate('pages-list-page') . "?m=2");
            } else {
                return 'Redirect: ' . $this->router->generate('pages-list-page') . "?m=2";
            }
        }
        $page = $this->core->api('Page/' . $id, 'GET')->run();
        if ($page['headers'][0][2] === 422) {
            if (isset($_GET['template']) === false) {
                return redirect($this->router->generate('pages-list-page') . "?m=2");
            } else {
                return 'Redirect: ' . $this->router->generate('pages-list-page') . "?m=2";
            }
        } elseif (($page["headers"][0][2] - 200) * ($page["headers"][0][2] - 299) > 0) {
            if (headers_sent() === false) {
                foreach ($page["headers"] as $header) {
                    header($header[0], $header[1], $header[2]);
                }
            }
            return $this->templates->render("500", [
                "error" => $page['response'],
                "result" => ''
            ]);
        }

        $messages = [
            'error' => '',
            'info' => '',
            'success' => '',
            'warning' => ''
        ];
        if (empty($request['m']) === false) {
            if ($request['m'] == 1) {
                $messages['success'] = 'Page created successfully.';
            }
        }

        $pages_list = $this->core->api('Page/all', 'GET')->run();
        return $this->templates->render("Main::Pages/Edit", [
            "messages" => $messages,
            "page" => $page['response'],
            "pages" => $pages_list['response']
        ]);
    }
47558
public function displayOrders(Request $request)
    {
        $page = (int) $request->query->get('page', 1);
        $perPage = (int) $request->query->get('per-page', 10);
        $offsetStart = 0;

        $todo = $request->query->get('todo', Order::STATUS_TODO);
        $start = $request->query->get('start', Order::STATUS_NO_FILTER);
        $limit = $request->query->get('limit', []);

        if ($page > 0) {
            $offsetStart = ($page - 1) * $perPage;
        }

        $sort = $request->query->get('sort');

        $baseIds = array_keys($this->getAclForUser()->get_granted_base([\ACL::ORDER_MASTER]));

        $ordersListTodo = $this->getOrderRepository()->listOrders($baseIds, $offsetStart, $perPage, $sort,
            ['todo' => Order::STATUS_TODO, 'created_on' => $start, 'limit' => $limit]);
        $ordersListProcessed = $this->getOrderRepository()->listOrders($baseIds, $offsetStart, $perPage, $sort,
            ['todo' => Order::STATUS_PROCESSED, 'created_on' => $start, 'limit' => $limit]);
        $totalTodo = $this->getOrderRepository()->countTotalOrders($baseIds, ['todo' => Order::STATUS_TODO, 'created_on' => $start, 'limit' => $limit]);
        $totalProcessed = $this->getOrderRepository()->countTotalOrders($baseIds, ['todo' => Order::STATUS_PROCESSED, 'created_on' => $start, 'limit' => $limit]);

        return $this->render('prod/orders/order_box.html.twig', [
            'page'         => $page,
            'perPage'      => $perPage,
            'totalTodo'        => $totalTodo,
            'totalProcessed' => $totalProcessed,
            'orders_todo'       => new ArrayCollection($ordersListTodo),
            'orders_processed'       => new ArrayCollection($ordersListProcessed),
            'todo' => $todo,
            'start' => $start,
            'date' => $limit ?  $limit['date']: null
        ]);
    }
1096764
public function putAction(Request $request, $id)
    {
        $this->checkAccess('PUT', $id);
        $resource = $this->getResourceManager()->find($id);
        return $this->processPut($request, $resource);
    }
31031
public function update(Request $request, $id)
    {
        $this->model = $this->model->findOrFail($id);

        $request = $this->processRequest($request);

        if ($request === true) {
            return $this->redirection();
        }

        $this->validate($request, $this->model->rules());

        $this->model->update($request->all());

        $saved = $this->afterSaving($request);

        if ($saved) {
            return $this->redirection();
        }
    }
417709
public function editAction(Request $request, $id)
    {
        $em = $this->getDoctrine()->getManager();
        $template = $em->getRepository('OpiferContentBundle:Template')->find($id);

        $form = $this->createForm(TemplateType::class, $template);
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $em->flush();

            return $this->redirectToRoute('opifer_cms_template_edit', ['id' => $template->getId()]);
        }

        return $this->render('OpiferCmsBundle:Backend/Template:edit.html.twig', [
            'form' => $form->createView(),
            'template' => $template,
        ]);
    }
932746
public function update(Request $request, $id)
    {
        try {
            $this->permissionRepositoryInterface->update($request->all(), $id);
        } catch (FormValidationException $e) {
            Flash::error($e->getMessage());

            return redirect()
              ->route('permissions.edit', ['id' => $id])
              ->withErrors($e->getErrors())
              ->withInput();
        } catch (PermissionsException $e) {
            Flash::error($e->getMessage());

            return redirect()->route('permissions.index');
        }

        Flash::success(trans('dashboard::dashboard.flash.permission.edit.success'));

        return redirect()->route('permissions.edit', ['id' => $id]);
    }
1334882
public function deleteAction(Request $request, $id)
    {
        $this->checkAccess('DELETE', $id);
        $resource = $this->getResourceManager()->find($id);
        $this->getResourceManager()->remove($resource);
        $view = $this->view(null, \FOS\RestBundle\Util\Codes::HTTP_OK);
        return $this->handleView($view);
    }