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
510356
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));
                    $order->setAllowDelete($this->getDependencyManager()->allowDelete($order));
                }

                return $order;
            }
        );

        $view->setSerializationContext(
            SerializationContext::create()->setGroups(
                ['Default', 'partialCategory']
            )
        );

        return $this->handleView($view);
    }
631567
public function upload($id, Request $request)
    {
        $entity = $this->getQuery()->where('id', $id)->first();

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

        $manager = $this->getManager();

        if ($request->file('file') === null) {
            return $this->error(['errors' => ['message' => 'Missing file']]);
        }

        $result = $manager->uploadFile(
            $entity,
            $request->file('file')
        );

        if (!$result->ok()) {
            return $this->error(['errors' => $result->getSimpleErrors()]);
        }

        return $this->success(['data' => $this->getManager()->getSerializer()->serialize($result->getResource())->toArray()], 201);
    }
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);
    }
126165
public function getAction($id, Request $request)
    {
        try {
            $locale = $this->getRequestParameter($request, 'locale', true);
            $mediaManager = $this->getMediaManager();
            $view = $this->responseGetById(
                $id,
                function($id) use ($locale, $mediaManager) {
                    $media = $mediaManager->getById($id, $locale);
                    $collection = $media->getEntity()->getCollection();

                    if (SystemCollectionManagerInterface::COLLECTION_TYPE === $collection->getType()->getKey()) {
                        $this->getSecurityChecker()->checkPermission(
                            'sulu.media.system_collections',
                            PermissionTypes::VIEW
                        );
                    }

                    $this->getSecurityChecker()->checkPermission(
                        new SecurityCondition(
                            $this->getSecurityContext(),
                            $locale,
                            $this->getSecuredClass(),
                            $collection->getId()
                        ),
                        PermissionTypes::VIEW
                    );

                    return $media;
                }
            );
        } catch (MediaNotFoundException $e) {
            $view = $this->view($e->toArray(), 404);
        } catch (MediaException $e) {
            $view = $this->view($e->toArray(), 400);
        }

        return $this->handleView($view);
    }
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);
    }
77511
protected function moveEntity($id, Request $request)
    {
        $destinationId = $this->getRequestParameter($request, 'destination');
        $locale = $this->getRequestParameter($request, 'locale', true);
        $collection = $this->getCollectionManager()->move($id, $locale, $destinationId);
        $view = $this->view($collection);

        return $this->handleView($view);
    }
887129
public function deleteAction(Request $request, $id)
    {
        $locale = $this->getLocaleManager()->retrieveLocale($this->getUser(), $request->get('locale'));

        $delete = function ($id) use ($locale){
            $this->getManager()->delete($id, $this->getUser()->getId());
        };
        $view = $this->responseDelete($id, $delete);

        return $this->handleView($view);
    }
700611
public function update(Request $request, $id)
    {
        $node = Menu::where('id', $id)->first();

        $this->moveNode($request, $node);
        $this->updateNode($request, $node);

        return $this->response()->item($node, new NodeTransformer());
    }
309818
public function issue($id, Request $request)
    {
        $resource = $this->getManager()->getRepository()->findOneById($id);

        if (!$resource) {
            return $this->not_found();
        }

        $result = $this->getManager()->issue($resource);

        if ($result->ok()) {
            return $this->success([
                'data' => $this->getManager()->getSerializer()->serialize($result->getResource(), collect($this->queryable))->all(),
            ]);
        }

        return $this->error([
            'errors' => $result->getSimpleErrors(),
        ]);
    }
1024726
public function show($id, ShowRequest $request)
    {
        $user = $request->user();
        $item = $user->notifications()->find($id);
        if (empty($item)) {
            return $this->sendError('Notification not found');
        }
        $item->load($request->getWith());

        return $this->sendResponse($item, '');
    }
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,
        ]);
    }
182268
public function reorder($id, Request $request)
    {
        $this->authorize('moveCategories');
        $this->validate($request, ['weight' => ['required']]);

        $category = $this->model()->find($id);

        return $this->updateModel($category, ['weight' => $request->input('weight')]);
    }
1027690
public function show($id, ShowRequest $request)
    {
        $user = $this->repository->findWithoutFail($id);
        $user->load($request->getWith());

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

        return $this->sendResponse($user, '');
    }
1057783
public function restore($id, Request $request)
    {
        $model = $this->model()->withTrashed()->find($id);

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

        if ($model->trashed()) {
            $model->timestamps = false;
            $model->restore();
            $model->timestamps = true;

            return $this->response($model, $this->trans('restored'));
        }

        return $this->notFoundResponse();
    }
1025884
public function showAction(Request $request, $id)
    {
        $this->checkIfUserHasPermission(Permission::VIEW);

        list($parentEntity) = $this->getParentEntityDefinition($request);

        $entity = $this->getEntity($id);

        $this->getEventDispatcher()->dispatch(
            Events::PRE_CRUD_CONTROLLER_ACTION,
            new CrudControllerActionEvent($this->meta, __FUNCTION__)
        );

        try {
            $this->getCustomObjectLoader()->loadCustomObjects($entity);
        } catch (CustomObjectException $ex) {
        }

        $view = $this->getEntityToShowViewTransformer()->transform($this->meta, $entity);

        return $this->renderResponse('show', [
            'entity'        => $entity,
            'meta'          => $this->meta,
            'parent_entity' => $parentEntity,
            'view'          => $view,
        ], $request->isXmlHttpRequest());
    }
1181464
public function update(Request $request, $id)
    {
        $entry = $this->entriesRepository->getById($id, $this->resource);
        $this->validate($request, $this->validationRules($this->resource, $entry));

        $this->entriesRepository->update($id, $request, $this->resource);

        return redirect()->back()->with('success', 'Updated');
    }
823878
public function crudShow(Request $request, $id)
    {
        try{

          $entity = $this->throwEntityNotFoundException($this->getRepository()->find($id));
          $form = $this->createDeleteForm($id)->createView();
          
          return $this->commonsResponseVars(compact('entity','form'));
        }catch(\Exception $e){
           return $this->failure($e);
        }
    }