How to pass default value for a parameter in Symfony routing.

Sometimes we need to pass a default to any of the passed parameter in a Symfony Routing. Thankfully Symfony Routing has this option as to set in 2nd parameter. Below is how to do this :

While registering a router :


1
2
3
acme_read_company:
    path:     /company_read/{id}
    defaults: { _controller: "AcmeDemoBundle:Default:readCompany", id:0 }

Comments

Popular posts from this blog

Filtering and Sorting a Doctrine Arraycollection

Doctrine mapping (ORM) with Database (DAL), Unidirectional vs Bidirectional.

Drupal 7 - How to make dynamic select box through Drupal #ajax framework