symfony - separate a website functions into group -


i using symfony2, need separate functions of website in groups, store can use function when group of function owned store, use case quite simple, when try design way this, find quite nasty. original idea check whether group owned store in every action, ,every action function, means have mark group actions, design need tremendous work, have better idea this? searched lot, didn't find bundle , or resource this, seems use case edge.

if i've understood question need have role-based access specific actions or set of actions. so, can start creating controller each set of actions prefix identifies relative set.

1 - creating controller group of actions

use sensio\bundle\frameworkextrabundle\configuration\route; use sensio\bundle\frameworkextrabundle\configuration\method;  /**  * @route("/store")  */ class storecontroller extends controller {     /**      * @route("/foo/{bar}")      * @method({"get", "post"})      */      public function fooaction($bar) { } } 

2 - group/role-based set of actions

now need enable access control set of routes. example:

#app/config/security.yml   security:   # ...   firewalls:      # ...      default:          # ...   access_control:      # require role_store /store*      - { path: ^/store, roles: role_store } 

Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -