Finds and displays a BrandModel entity.

@Route("/{id}")
@Method("GET")
@Template()
344407
public function showAction(BrandModel $brandModel)
    {
        $deleteForm = $this->createDeleteForm($brandModel);

        return array(
            'entity' => $brandModel,
            'delete_form' => $deleteForm->createView(),
        );
    }
341048
public function findModel($id = false, $search = false)
    {
        $class = static::getModelClass($this->modelName) . ($search ? 'Search' : '');
        $model = new $class();
        if ($id && (!$model = $model->search(compact('id'))->one())) {
            throw new NotFoundHttpException('The requested page does not exist.');
        }
        return $model;
    }
1076622
public function getLoadedModel($id)
    {
        return isset($this->_loadModels[$id]) ? $this->_loadModels[$id] : null;
    }
564227
protected function findModel($id)
    {
        if (($model = \yongtiger\admin\models\Log::findOne($id)) !== null) {
            return $model;
        } else {
            throw new NotFoundHttpException('The requested page does not exist.');
        }
    }
1276847
public function modelJsonAction($id)
    {
        $em = $this->getDoctrine()->getManager();
        
        $brand = $em->getRepository('EcommerceBundle:Brand')->find($id);

        if (!$brand instanceof Brand){
            throw $this->createNotFoundException('Unable to find Brand entity.');
        }
            
        $entities = $em->getRepository('EcommerceBundle:BrandModel')->findByBrand($brand);

        $returnValues = array();
        foreach ($entities as $entity) {
            $returnValues[$entity->getId()] =  $entity->getName() ;
        }
        return new JsonResponse($returnValues);
    }
1294984
public function findOrFail($id)
    {
        if ($model = $this->find($id)) {
            return $model;
        }
        throw (new ModelNotFoundException)->setModel(get_class($this->getModel()));
    }
805598
protected function responseGetById($id, $findCallback)
    {
        $entity = $findCallback($id);

        if (!$entity) {
            $exception = new EntityNotFoundException(self::$entityName, $id);
            // Return a 404 together with an error message, given by the exception, if the entity is not found
            $view = $this->view(
                $exception->toArray(),
                404
            );
        } else {
            $view = $this->view($entity, 200);
        }

        return $view;
    }
577087
protected function findModel($id)
    {
        if (($model = Message::find()
                ->where(['id' => $id, 'parent' => null])->andWhere(['or', ['from_id' => Yii::$app->user->id], ['user_id' => Yii::$app->user->id]])->limit(1)->one()) !== null
        ) {
            return $model;
        } else {
            throw new NotFoundHttpException (Yii::t('message', 'The requested page does not exist.'));
        }
    }
1126935
public function indexAction()
    {
        $businessEntityHelper = $this->get('victoire_core.helper.business_entity_helper');

        //services
        $em = $this->get('doctrine.orm.entity_manager');

        //the repository
        $repository = $em->getRepository('VictoireBusinessPageBundle:BusinessTemplate');

        $BusinessTemplates = [];

        $businessEntities = $businessEntityHelper->getBusinessEntities();

        foreach ($businessEntities as $businessEntity) {
            $name = $businessEntity->getName();

            //retrieve the pagePatterns
            $pagePatterns = $repository->findPagePatternByBusinessEntity($businessEntity);

            $BusinessTemplates[$name] = $pagePatterns;
        }

        return new JsonResponse([
                'html' => $this->container->get('templating')->render(
                    'VictoireBusinessPageBundle:BusinessEntity:index.html.twig',
                    [
                        'businessEntities'  => $businessEntities,
                        'BusinessTemplates' => $BusinessTemplates,
                    ]
                ),
                'success' => true,
            ]);
    }
628254
public function showAction(Request $request, $id, $parameterBag)
    {
        $em = $this->getDoctrine()->getManager();
        $entity = $em->getRepository('AmulenPageBundle:Page')->find($id);
        $entity->setViewCount($entity->getViewCount() + 1);
        $em->flush();

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

        $locale = $request->getLocale();
        $seoPage = $this->container->get('sonata.seo.page');

        /* title */
        $title = $em->getRepository('AmulenPageBundle:Block')->findOneBy(array('page' => $id, 'name' => "title", "lang" => $locale));
        if ($title) {
            $pageTitle = $title->getContent() . " - " . $seoPage->getTitle();
        } else {
            $pageTitle = $entity->getName() . " - " . $seoPage->getTitle();
        }
        $seoPage
            ->setTitle($pageTitle);

        /* description */
        $description = $em->getRepository('AmulenPageBundle:Block')->findOneBy(array('page' => $id, 'name' => "description", "lang" => $locale));
        if ($description) {
            $pageDescription = $description->getContent();
        } else {
            $pageDescription = $entity->getDescription();
        }
        /* locale */
        $localeOg = $em->getRepository('AmulenPageBundle:Block')->findOneBy(array('page' => $id, 'name' => "locale", "lang" => $locale));
        if ($localeOg) {
            $pagelocale = $localeOg->getContent();
            $seoPage->addMeta('locale', 'og:locale', $pagelocale);
        } else {
            $seoPage->addMeta('locale', 'og:locale', $locale);
        }
        /* type */
        $type = $em->getRepository('AmulenPageBundle:Block')->findOneBy(array('page' => $id, 'name' => "type", "lang" => $locale));
        if ($type) {
            $pagelocale = $type->getContent();
            $seoPage->addMeta('type', 'og:type', $pagelocale);
        }
        /* type */
        $site_name = $em->getRepository('AmulenPageBundle:Block')->findOneBy(array('page' => $id, 'name' => "site_name", "lang" => $locale));
        if ($site_name) {
            $pagelocale = $site_name->getContent();
            $seoPage->addMeta('site_name', 'og:site_name', $pagelocale);
        }

        if (!is_null($entity->getImage()) && $entity->getImage() != "") {
            $siteUrl = $this->get("amulen.dashboard.service.setting")->getValue(Setting::SITE_URL);
            $seoPage->addMeta('property', 'og:image', str_replace(" ", "%20", $siteUrl . "/" . $entity->getImage()));
            $seoPage->addMeta('property', 'twitter:image', str_replace(" ", "%20", $siteUrl . "/" . $entity->getImage()));
        }
        $seoPage->addMeta('property', 'twitter:title', $pageTitle);
        $seoPage->addMeta('property', 'twitter:description', $pageDescription);

        $seoPage
            ->addMeta('name', 'description', $pageDescription)
            ->addMeta('property', 'og:title', $pageTitle)
            ->addMeta('property', 'og:description', $pageDescription);
        return $this->render($entity->getTemplate(), array('page' => $entity, 'parameterBag' => $parameterBag));
    }
911794
public function preview($entity, $id)
    {
        $modelString = 'Grafite\Cms\Models\\'.ucfirst($entity);

        if (!class_exists($modelString)) {
            $modelString = 'Grafite\Cms\Models\\'.ucfirst($entity).'s';
        }

        $model = new $modelString();
        $modelInstance = $model->find($id);

        $data = [
            $entity => $modelInstance,
        ];

        if (config('app.locale') != config('cms.default-language', Cms::config('cms.default-language'))) {
            if ($modelInstance->translation(config('app.locale'))) {
                $data = [
                    $entity => $modelInstance->translation(config('app.locale'))->data,
                ];
            }
        }

        $view = 'cms-frontend::'.$entity.'.show';

        if (!View::exists($view)) {
            $view = 'cms-frontend::'.$entity.'s.show';
        }

        if ($entity === 'page') {
            $view = 'cms-frontend::pages.'.$modelInstance->template;
        }

        if ($entity === 'blog') {
            $view = 'cms-frontend::blog.'.$modelInstance->template;
        }

        return view($view, $data);
    }
36044
public function show($id)
	{
		// get the info for that entry
		$model = $this->crud['model'];
		$this->data['entry'] = $model::find($id);
		$this->data['entry']->addFakes($this->getFakeColumnsAsArray());
		$this->data['crud'] = $this->crud;

		// load the view from /resources/views/vendor/dick/crud/ if it exists, otherwise load the one in the package
		return $this->firstViewThatExists('vendor.dick.crud.show', 'crud::show', $this->data);
	}
584710
public function showAction()
    {
        $id = (int) $this->params()->fromRoute('id', null);

        $service = $this->getService();
        $entity  = $service->getById($id);

        $view = new ViewModel(array(
            'entity'  => $entity,
            'options' => $this->getOptions(),
        ));

        if ($this->getOptions()->getDisplayDiagrammInDetailView()) {
            $diagramm = $this->getService()->createUseCaseDiagrammFor($entity);
            $view->setVariable('diagramm', $diagramm);
        }

        return $view;
    }
156750
public function showBusinessPageByIdAction(Request $request, $entityId, $type)
    {
        $businessEntityHelper = $this->get('victoire_core.helper.queriable_business_entity_helper');
        $businessEntity = $businessEntityHelper->findById($type);
        $entity = $businessEntityHelper->getByBusinessEntityAndId($businessEntity, $entityId);

        $refClass = new \ReflectionClass($entity);

        $templateId = $this->get('victoire_business_page.business_page_helper')
            ->guessBestPatternIdForEntity($refClass, $entityId, $this->container->get('doctrine.orm.entity_manager'));

        $page = $this->get('victoire_page.page_helper')->findPageByParameters([
            'viewId'   => $templateId,
            'entityId' => $entityId,
            'locale'   => $request->getLocale(),
        ]);

        return $this->redirect(
            $this->generateUrl(
                'victoire_core_page_show',
                [
                    'url' => $page->getReference()->getUrl(),
                ]
            )
        );
    }
1013434
public function findModel($id)
    {
        if (($model = Category::findOne($id)) !== null) {
            return $model;
        } else {
            throw new NotFoundHttpException (Yii::t('system', 'The requested page does not exist.'));
        }
    }
651326
public function show($id)
    {
        $modelName = $this->modelFullName;
        $model = $modelName::find($id);
        if(!$model) throw new NotFoundException('There is no Resource with id = ' . $id . ' !');
        return $model;
    }
84430
protected function findModel($id)
    {
        if (($model = Order::findOne($id)) !== null) {
            return $model;
        } else {
            throw new NotFoundHttpException(t('app', 'The requested page does not exist.'));
        }
    }