Understanding how controller methods work in bolt

Discussion for various published PHP frameworks, including Zend Framework, CodeIgniter, Kohana, CakePHP, Yii, Symfony, and others.

Moderator: General Moderators

Post Reply
User avatar
gautamz07
Forum Contributor
Posts: 331
Joined: Wed May 14, 2014 12:18 pm

Understanding how controller methods work in bolt

Post by gautamz07 »

Hey guys i just need to understand the below line of code :

Code: Select all

preview:
    path: /preview/{contenttypeslug}
    defaults:
        _controller: controller.frontend:preview
    requirements:
        contenttypeslug: controller.requirement:anyContentType
From the above lines of code what does the below line of code really do:

Code: Select all

defaults:
        _controller: controller.frontend:preview
??

If i check the docs here https://docs.bolt.cm/2.2/templates/temp ... ting-entry

it says the following:
controller method which will be called when this route matches.
But i still don't quite understand this line of code , where is this method exactly and when will it be called ??
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Understanding how controller methods work in bolt

Post by Celauran »

Which version of Bolt are you using? The routing appears to be from 3.x and you're referencing documentation from 2.x

Bolt uses Symfony routing under the hood, and they have some pretty good documentation also.
http://symfony.com/doc/3.1/routing.html
http://symfony.com/doc/3.1/components/routing.html
User avatar
gautamz07
Forum Contributor
Posts: 331
Joined: Wed May 14, 2014 12:18 pm

Re: Understanding how controller methods work in bolt

Post by gautamz07 »

Wow thanks celauran !

and i am using bolt 3.1+ .. sometimes i referance old docs just to see if i can get a clue :P

Thanks alot ... i'll referance the symfony docs and see what i can understand :D

TY
Post Reply