@Route("/{id}/{slug}", requirements={"id": "[1-9]\d*"}, name="vgr_player_index")
@Method("GET")
@Cache(smaxage="10")

@param int $id
@param string $slug
@return \Symfony\Component\HttpFoundation\Response
14921
public function indexAction($id, $slug)
    {
        $player = $this->getDoctrine()->getRepository('VideoGamesRecordsCoreBundle:Player')->getPlayerWithGames($id);
        if ($slug !== $player->getSlug()) {
            return $this->redirectToRoute('vgr_player_index', ['id' => $player->getIdPlayer(), 'slug' => $player->getSlug()], 301);
        }

        $nbPlayer = $this->getDoctrine()->getRepository('VideoGamesRecordsCoreBundle:Player')->getNbPlayer(['nbChart>0' => true]);

        $rows = $this->getDoctrine()->getRepository('VideoGamesRecordsCoreBundle:PlayerChart')->getRows(
            [
                'idPlayer' => $id,
                'limit' => 1,
                'orderBy' => [
                    'column' => 'pc.dateModif',
                    'order' => 'DESC',
                ],
            ]
        );
        if (count($rows) == 1) {
            $lastChart = $rows[0];
        } else {
            $lastChart = null;
        }

        //----- breadcrumbs
        $breadcrumbs = $this->get('white_october_breadcrumbs');
        $breadcrumbs->addRouteItem('Home', 'homepage');
        $breadcrumbs->addItem($player->getPseudo());

        return $this->render(
            'VideoGamesRecordsCoreBundle:Player:index.html.twig',
            [
                'player' => $player,
                'nbPlayer' => $nbPlayer,
                'lastChart' => $lastChart
            ]
        );
    }
1022949
public function get($slug){
        return empty($this->index[$slug]) ? null : $this->index[$slug];
    }
315884
public function retrieveActiveBySlug($slug)
    {
        $query = $this->createQueryBuilder('c')
            ->where('c.isActive = :isActive')
            ->andWhere('c.slug = :slug')
            ->orderBy('c.rank', 'ASC')
            ->setMaxResults(1)
            ->getQuery();

        $query->setParameter('isActive', true);
        $query->setParameter('slug', $slug);

        return $query->getOneOrNullResult();
    }
911248
public function view($slug = null, $id = null)
    {
        //This allows backward compatibility for URLs like `/photo/11`
        if (empty($slug)) {
            $slug = $this->Photos->findById($id)
                ->contain([$this->Photos->Albums->getAlias() => ['fields' => ['slug']]])
                ->extract('album.slug')
                ->first();

            return $this->redirect(compact('id', 'slug'), 301);
        }

        $photo = $this->Photos->findActiveById($id)
            ->select(['id', 'album_id', 'filename', 'active', 'modified'])
            ->contain([$this->Photos->Albums->getAlias() => ['fields' => ['id', 'title', 'slug']]])
            ->cache(sprintf('view_%s', md5($id)), $this->Photos->getCacheName())
            ->firstOrFail();

        $this->set(compact('photo'));
    }
898396
public static function load(string $slug)
    {
        $instance = new static();

        $instance->route = [];
        $instance->route['slug'] = $slug;
        $instance->route['groups'] = collect([]);

        return $instance;
    }
299582
public function show($slug)
    {
        return collect($this->metrics->snapshotsForJob($slug))->map(function ($record) {
            $record->runtime = round($record->runtime / 1000, 3);
            $record->throughput = (int) $record->throughput;

            return $record;
        });
    }
423389
public function actionView($id = 0, $slug= '')
    {
        $model = $this->findModel($id, $slug);
        if (\Yii::$app->user->can('viewPost', ['post' => $model])) {
            return $this->render('view', [
                'model' => $model,
            ]);
        } else
            throw new ForbiddenHttpException(Module::t('core', 'Access denied.'));
    }
618472
public static function findByThemeId( $slug, $type, $themeId ) {

		return self::queryBySlugType( $slug, $type, [ 'ignoreSite' => true ] )->andWhere( 'themeId=:themeId', [ ':themeId' => $themeId ] )->one();
	}
383816
public function block($slug)
    {
        $block = $this->findABlock($slug);

        if (!$block) {
            $this->update([
                'blocks' => json_encode(array_merge($this->blocks, [ $slug => '' ]))
            ]);
        }

        return $block;
    }
173768
public function showAction($slug)
    {
        $category = $this->getCategoryRepository()->retrieveActiveBySlug($slug);

        if (!$category) {
            throw $this->createNotFoundException('category doesnt exists');
        }

        return $this->render(
            'GenjFaqBundle:Category:show.html.twig',
            array(
                'category' => $category
            )
        );
    }
1271523
protected function validatePost($title, $slug, $id = null)
	{
		$rules = array(
			'title' => 'required',
			'slug'  => 'required|unique:posts,slug',
		);

		if ($id)
		{
			$rules['slug'] .= ','.$id;
		}

		with($validator = Validator::make(compact('title', 'slug'), $rules))->fails();

		return $validator->errors();
	}
933584
public function show($slug)
    {
        $page = Page::published()
            ->where('slug', $slug)
            ->first();

        if ($page === null) {
            app()->abort(404, 'page with slug \''.$slug.'\' not found');
        }

        $this->authorize('show', $page);

        return view('site::page')->with('page', $page);
    }
842561
public function page($slug, $action)
    {
        $route = $this->addRoute('GET', $slug, $action);
        $route->setWordpressConditional('is_page');

        return $route;
    }
357579
function getCategory($id){
        if(is_numeric($id))
            $model=self::where('id',$id)->select();
        else
            $model=self::where('slug',$id)->select();

        $model->where('model_type',$this->modelType);

        return $model->first();
    }
538359
public static function fromId($id)
    {
        $salt = md5(uniqid().$id);
        $alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
        $slug = with(new Hashids($salt, $length = 8, $alphabet))->encode($id);

        return new Slug($slug);
    }
1265499
public function getBySlug($slug)
    {
        $image = $this->adapter->get(sprintf('%s/images/%s', $this->endpoint, $slug));

        $image = json_decode($image);

        return new ImageEntity($image->image);
    }
193000
public function viewAction($collectionId, $slug)
    {
        $collection = $this->get('sonata.classification.manager.collection')->findOneBy(['id' => $collectionId]);

        if (!$collection) {
            throw new NotFoundHttpException(sprintf('Unable to find the collection with id=%d', $collectionId));
        }

        return $this->render('SonataProductBundle:Collection:view.html.twig', [
           'collection' => $collection,
        ]);
    }