{"action":"created","issue":{"url":"https://api.github.com/repos/Sylius/Sylius/issues/2787","labels_url":"https://api.github.com/repos/Sylius/Sylius/issues/2787/labels{/name}","comments_url":"https://api.github.com/repos/Sylius/Sylius/issues/2787/comments","events_url":"https://api.github.com/repos/Sylius/Sylius/issues/2787/events","html_url":"https://github.com/Sylius/Sylius/issues/2787","id":82105559,"number":2787,"title":"How can i create custom service for a frontend controller  extended from resourcecontroller","user":{"login":"tuxado","id":7065151,"avatar_url":"https://avatars.githubusercontent.com/u/7065151?v=3","gravatar_id":"","url":"https://api.github.com/users/tuxado","html_url":"https://github.com/tuxado","followers_url":"https://api.github.com/users/tuxado/followers","following_url":"https://api.github.com/users/tuxado/following{/other_user}","gists_url":"https://api.github.com/users/tuxado/gists{/gist_id}","starred_url":"https://api.github.com/users/tuxado/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tuxado/subscriptions","organizations_url":"https://api.github.com/users/tuxado/orgs","repos_url":"https://api.github.com/users/tuxado/repos","events_url":"https://api.github.com/users/tuxado/events{/privacy}","received_events_url":"https://api.github.com/users/tuxado/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-28T20:14:14Z","updated_at":"2015-06-07T16:24:56Z","closed_at":null,"body":"I want to add a costumised services for a frontend controller  extended from resourcecontroller like this \r\n\r\n    $ sylius_product:\r\n    driver: doctrine/orm\r\n    classes:\r\n        product:\r\n            model: Sylius\\Component\\Core\\Model\\Product\r\n            controller: Sylius\\Bundle\\CoreBundle\\Controller\\ProductController\r\n            repository: Sylius\\Bundle\\CoreBundle\\Doctrine\\ORM\\ProductRepository\r\n            form:\r\n                default: Sylius\\Bundle\\CoreBundle\\Form\\Type\\ProductType\r\n            translation:\r\n                model: Sylius\\Component\\Core\\Model\\ProductTranslation\r\n                form:\r\n                    default: Sylius\\Bundle\\CoreBundle\\Form\\Type\\ProductTranslationType\r\n            frontend:\r\n                account:\r\n                    controller: Sylius\\Bundle\\WebBundle\\Controller\\Frontend\\Account\\ProductController\r\n                    repository: sylius.repository.product\r\n                    form:\r\n                        default: Sylius\\Bundle\\CoreBundle\\Form\\Type\\ProductType\r\n                    translation:\r\n                        model: Sylius\\Component\\Core\\Model\\ProductTranslation\r\n                        form:\r\n    $                            default: Sylius\\Bundle\\CoreBundle\\Form\\Type\\ProductTranslationType\r\n\r\ni add some code to dependencies injections extension of the product bundle but i stuck to inject the configuration argument.\r\n\r\n\r\n\r\n\r\n\r\n    $ public function process(array $config, ContainerBuilder $container)\r\n    {\r\n\t$controllerConfiguration = new Definition('Sylius\\Bundle\\ResourceBundle\\Controller\\Configuration');\r\n        $controllerConfiguration\r\n            ->setFactoryService('sylius.controller.configuration_factory')\r\n            ->setFactoryMethod('createConfiguration')\r\n            ->setArguments(array($this->prefix, $this->resourceName, $this->templates))\r\n            ->setPublic(false)\r\n        ;\r\n\t\r\n\t\t\r\n\t\t\r\n\t\t$productFrontendAccountControllerClass = $config['classes']['frontend']['account']['controller'];\r\n\t\t\r\n\t\t$productFrontendAccountController = new Definition($productFrontendAccountControllerClass);\r\n\t\t\r\n\r\n\t\t$fieldFormType\r\n            ->setArguments(array($controllerConfiguration));\r\n\t\t\r\n\t\t$container->setDefinition('sylius.controller.frontend.account.product', $productFrontendAccountController);\t\r\n\t\t\r\n\t\treturn parent::process($config, $container);\r\n\t}\r\n\r\nCan any one explaine me how to performe this \r\n\r\nthx\r\n\r\nps : i dont know how to add code in issue :) it why i add  $ at the begining of some lines"},"comment":{"url":"https://api.github.com/repos/Sylius/Sylius/issues/comments/109768372","html_url":"https://github.com/Sylius/Sylius/issues/2787#issuecomment-109768372","issue_url":"https://api.github.com/repos/Sylius/Sylius/issues/2787","id":109768372,"user":{"login":"rapemer","id":10545057,"avatar_url":"https://avatars.githubusercontent.com/u/10545057?v=3","gravatar_id":"","url":"https://api.github.com/users/rapemer","html_url":"https://github.com/rapemer","followers_url":"https://api.github.com/users/rapemer/followers","following_url":"https://api.github.com/users/rapemer/following{/other_user}","gists_url":"https://api.github.com/users/rapemer/gists{/gist_id}","starred_url":"https://api.github.com/users/rapemer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rapemer/subscriptions","organizations_url":"https://api.github.com/users/rapemer/orgs","repos_url":"https://api.github.com/users/rapemer/repos","events_url":"https://api.github.com/users/rapemer/events{/privacy}","received_events_url":"https://api.github.com/users/rapemer/received_events","type":"User","site_admin":false},"created_at":"2015-06-07T16:24:56Z","updated_at":"2015-06-07T16:24:56Z","body":"\r\n1. step config.yml\r\n\r\n        sylius_resource:\r\n            resources:\r\n                app.[component_name]:\r\n                    drive: doctrine/orm\r\n                    templates: AppWebBundle:Frontend/Somefolder\r\n                    classes:\r\n                        model: # namespace of your entity (model)\r\n                        repository: repostiory must extends Sylius EntityRepository (use Sylius\\Bundle\\ResourceBundle\\Doctrine\\ORM\\EntityRepository; ... extends EntityRepository)\r\n\r\n2. step create services services.yml\r\n\r\n        # 2.1. EntityManager alias:\r\n        app.manager.my_component:\r\n            alias: doctrine.orm.default_entity_manager\r\n\r\n        # 2.2. create configuration\r\n        app.config.my_component:\r\n            class: Sylius\\Bundle\\ResourceBundle\\Controller\\Configuration\r\n            public: false\r\n            factory_service: sylius.controller.configuration_factory\r\n            factory_method: createConfiguration\r\n            arguments: [app, my_component, null]\r\n\r\n        # 2.3. controller as service:\r\n        app.controller.my_component:\r\n            class: App\\Bundle\\AppBundle\\Controller\\Backend\\MyCustomController\r\n            arguments: [@app.config.my_component]\r\n            calls:\r\n                - [setContainer, [@service_container]]\r\n\r\n3. step create user permissions inside CMS\r\n    - app.manage.my_custom (it's root permission)\r\n    - app.my_custom.show (parent app.manage.my_custom)\r\n    - app.my_custom.index (parent app.manage.my_custom)\r\n    - app.my_custom.create (parent app.manage.my_custom)\r\n    - app.my_custom.update (parent app.manage.my_custom)\r\n    - app.my_custom.delete (parent app.manage.my_custom)\r\n\r\n4. step create routing routing.yml\r\n\r\n        app_my_custom_index:\r\n            path: /administration/custom\r\n            defaults:\r\n                _controller: app.controller.my_custom:indexAction\r\n                _sylius:\r\n                    permission: show\r\n                    template: AppWebBundle:Frontend/Somefolder:index.html.twig\r\n"}}