Finds and displays a Contract entity.

@Route("/{id}")
@Method("GET")
@Template()
191295
public function showAction($id)
    {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('EcommerceBundle:Contract')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Contract entity.');
        }

        $deleteForm = $this->createDeleteForm($id);

        //get agreement
        $agreement = $entity->getAgreement();
        $paypalAgreement = $this->get('checkout_manager')->getPaypalAgreement($agreement->getPaypalId());
        
        $transactions = $this->get('checkout_manager')->searchPaypalAgreementTransactions($agreement);
                
        return array(
            'entity'      => $entity,
            'delete_form' => $deleteForm->createView(),
            'transactions' => $transactions,
            'paypalAgreement' => $paypalAgreement
        );
    }
174001
protected function findModel($id)
    {
        if (($model = TermOfProductType::findOne($id)) !== null) {
            return $model;
        } else {
            throw new NotFoundHttpException(t('app', 'The requested page does not exist.'));
        }
    }
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);
    }
371081
public function getById($id)
    {
        $query = $this->createQuery();
        $query->where(
            $query->buildAndSet([$this->getModel()->getTableKey(), '=', $id])
        );
        $result = $this->database->query($query);

        $model = null;
        if ($result) {
            $result = $result->fetchAll(\PDO::FETCH_ASSOC);
            $entities = $this->handleResult($result);
            $model = current($entities);
        }
        return $model;
    }
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());
    }
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);
    }
177186
function GetById($type, $id){
        $newClass = NAMESPACE_ENTITIES . $type;
        if(class_exists ($newClass)) {
            $class = new $newClass();
            $primaryKey = ModelState::GetPrimary($class);
            if ($primaryKey != null)
                return $this->Get($type, $primaryKey . '=' . $id)->FirstOrDefault();

            return null;
        }

        throw new OwlException("Classe {$newClass} não encontrada", 1);
    }
248955
public function showForm($id)
    {
        $form = $this->container->get('netvlies.form')->get($id);

        if ($form->getSuccess()) {
            return $this->container->get('templating')->render('NetvliesFormBundle:Twig:form_success.html.twig', array(
                'successMessage' => $form->getSuccessMessage(),
            ));
        } else {
            $formView = $form->getSf2Form()->createView();
            if ($this->container->getParameter('netvlies.form.templates.fields') != null) {
                $this->container->get('twig')->getExtension('form')->renderer->setTheme($formView, array($this->container->getParameter('netvlies.form.templates.fields')));
            }

            return $this->container->get('templating')->render($this->container->getParameter('netvlies.form.templates.form'), array(
                'id' => $form->getId(),
                'form' => $formView,
            ));
        }
    }
150260
public function findObject($entity, $_id)
	{
		$retValue = array();

		try{
			$query = array('_id' => new MongoId($_id));

			if (! is_null($this->_db)){
				$mongo = $this->_db->selectCollection($entity);

				// Find Object
				$retValue = $mongo->findOne($query);

				if (is_null($retValue))
					$retValue = array();
			}
		}
		catch(Exception $e) {
			$this->_log->addError($e->getMessage());
		}

		return $retValue;
	}
809992
public function getAction(Request $request, $id)
    {
        $document = $this->getModel()->getSerialised($id, $request);

        $response = $this->getResponse()
            ->setStatusCode(Response::HTTP_OK)
            ->setContent($document);

        return $response;
    }
409803
public function getView($id)
    {

        $model = (!empty($id) || $id === "0") ? $this->findAutoDetectTranslation($id) : $this->model;
        $form  = FormBuilder::create(get_class($this->form), [
            'model' => $model
        ]);

        $form_content = view('form-builder::form.components.formgenerator.info', [
            'form'  => $form,
            'id'    => $id,
            'route' => $this->getControllerNameForAction().'@',
        ]);

        $this->layoutManager->add([
            'content' => view('expendable::admin.form.state.form', [
                'form' => $form_content
            ])
        ]);

        return $this->layoutManager->render();

    }
189960
public function show($id = null)
    {
        // Check the ID
        if (!isset($id)) {
            throw new \InvalidArgumentException('Undefined ID', 400);
        }

        // Get record
        $item = $this->model->find($id);

        // Abort if the record is not found
        if (!$item) {
            throw new \Exception('Element not found', 404);
        }

        // Return response
        return [
            'success' => true,
            'data' => $item
        ];
    }
1242501
public function showAction(Request $request, $id)
    {
        $em = $this->getDoctrine()->getManager();

        /** @var Invoice $entity */
        $invoice = $em->getRepository('EcommerceBundle:Invoice')->find($id);

        if (!$invoice) {
            throw $this->createNotFoundException('Unable to find Invoice entity.');
        }

        // download invoice
        if (!$invoice ||
            false === $this->container->get('checkout_manager')->isCurrentUserOwner($invoice->getTransaction())) {
            throw new AccessDeniedException();
        }

        /** @var CheckoutManager $checkoutManager */
        $checkoutManager = $this->container->get('checkout_manager');

        $delivery = $invoice->getTransaction()->getDelivery();
        $totals = $checkoutManager->calculateTotals($invoice->getTransaction(), $delivery);
        if ('true' === $request->get('download')) {
            $html = $this->container->get('templating')->render('EcommerceBundle:Profile:Invoice/download.html.twig', array(
                    'delivery' => $delivery,
                    'invoice'  => $invoice,
                    'totals'   => $totals,
                ));
            $html2pdf = $this->get('html2pdf_factory')->create();
            $html2pdf->WriteHTML($html);
            
            return new Response(
                $html2pdf->Output('invoice'.$invoice->getInvoiceNumber().'.pdf'),
                200,
                array(
                    'Content-Type'        => 'application/pdf',
                    'Content-Disposition' => 'attachment; filename="invoice'.$invoice->getInvoiceNumber().'.pdf"'
                )
            );
        }
        
       
        return array(
            'entity' => $invoice,
            'totals' => $totals,
        );
    }
937614
public function viewAction($id)
    {
        $content = $this->contentManager->getContentById($id);

        if ($content === null) {
            throw EntityNotFoundException::fromClassNameAndIdentifier(
                $this->configurationManager->getEntityClass('content'),
                [$id]
            );
        }

        return $this->render('@SherlockodeAdvancedContent/Content/view.html.twig', [
            'content' => $content,
        ]);
    }
789507
public function show($id)
    {
        $apiRequest = RequestFactory::create();

        $resource = new GetResource(
            $this->serializer,
            $apiRequest->getFields(),
            $apiRequest->getIncludedRelationships()
        );

        $find = $this->findResourceCallable($id);

        return $this->addHeaders($resource->get($id, get_class($this->getDataModel()), $find));
    }
235480
public function showAction(Request $request, $access, $id)
    {
        $em = $this->getDoctrineManager();
        // Hack. The contextGetAction in CommonBundle is not as smart as it
        // looks.
        $message = null;
        if ($id instanceof Message) {
            $message = $id;
        } elseif (is_numeric($id)) {
            $message = $em->getRepository('BisonLabSakonninBundle:Message')
                    ->find($id);
        } else {
            $message = $em->getRepository('BisonLabSakonninBundle:Message')
                    ->findOneBy(array('message_id' => $id));
        }
        if (!$message) {
            return $this->returnNotFound($request, 'Unable to find Message.');
        }
        $this->denyAccessUnlessGranted('show', $message);
        // If it's shown to receiver, it's read.
        $sm = $this->container->get('sakonnin.messages');
        $user = $this->getUser();
        // Not sure I want to set READ automatically. But UNREAD/READ is not
        // archived, which the users should set themselves.
        if ($message->getTo() == $user->getId()) {
            $message->setState("READ");
            $em = $this->getDoctrineManager();
            $em->flush();
        }
        if ($this->isRest($access)) {
            return $this->returnRestData($request, $messages, array('html' =>'BisonLabSakonninBundle:Message:_show.html.twig'));
        }
        return $this->render('BisonLabSakonninBundle:Message:show.html.twig',
            array('entity' => $message));
    }
707206
public function displayAction($ident)
    {
        $entity = $this->getRepository()->findOneByLocaleBy(array(), array('slug' => $ident), $this->getRequest()->getLocale());

        if (!$entity) {
            throw new NotFoundHttpException("Page was not found!");
        }

        return [
            'page' => $entity
        ];
    }