Page 1 of 1

Understanding how controller methods work in bolt

Posted: Wed Nov 23, 2016 1:43 pm
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 ??

Re: Understanding how controller methods work in bolt

Posted: Wed Nov 23, 2016 5:06 pm
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

Re: Understanding how controller methods work in bolt

Posted: Thu Nov 24, 2016 12:28 am
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