diff --git a/docs/source/development/api.rst b/docs/source/development/api.rst index 012178cbe..6905075d9 100644 --- a/docs/source/development/api.rst +++ b/docs/source/development/api.rst @@ -109,6 +109,65 @@ Configure the api using Yaml (see the full configuration below): GET: true HEAD: true +.. note:: + + If you are working on a shared bundle (aka "The chill bundles"), you should define your configuration inside the class :code:`ChillXXXXBundleExtension`, using the "prependConfig" feature: + + .. code-block:: php + + namespace Chill\PersonBundle\DependencyInjection; + + use Symfony\Component\DependencyInjection\ContainerBuilder; + use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; + use Symfony\Component\HttpFoundation\Request; + + /** + * Class ChillPersonExtension + * Loads and manages your bundle configuration + * + * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html} + * @package Chill\PersonBundle\DependencyInjection + */ + class ChillPersonExtension extends Extension implements PrependExtensionInterface + { + public function prepend(ContainerBuilder $container) + { + $this->prependCruds($container); + } + + /** + * @param ContainerBuilder $container + */ + protected function prependCruds(ContainerBuilder $container) + { + $container->prependExtensionConfig('chill_main', [ + 'apis' => [ + [ + 'class' => \Chill\PersonBundle\Entity\AccompanyingPeriod\Origin::class, + 'name' => 'accompanying_period_origin', + 'base_path' => '/api/1.0/person/accompanying-period/origin', + 'controller' => \Chill\PersonBundle\Controller\OpeningApiController::class, + 'base_role' => 'ROLE_USER', + 'actions' => [ + '_index' => [ + 'methods' => [ + Request::METHOD_GET => true, + Request::METHOD_HEAD => true + ], + ], + '_entity' => [ + 'methods' => [ + Request::METHOD_GET => true, + Request::METHOD_HEAD => true + ] + ], + ] + ] + ] + ]); + } + } + The :code:`_index` and :code:`_entity` action =============================================