diff --git a/bundles/content/configuration.rst b/bundles/content/configuration.rst index 3d6261bc..b5ca2a29 100644 --- a/bundles/content/configuration.rst +++ b/bundles/content/configuration.rst @@ -30,6 +30,7 @@ is the following configuration: .. code-block:: yaml + # app/config/config.yml cmf_content: persistence: phpcr: @@ -41,6 +42,7 @@ is the following configuration: .. code-block:: xml + @@ -60,15 +62,18 @@ is the following configuration: .. code-block:: php - $container->loadFromExtension('cmf_content', array( - 'persistence' => array( - 'phpcr' => array( + // app/config/config.php + $container->loadFromExtension('cmf_content', [ + 'persistence' => [ + 'phpcr' => [ 'enabled' => false, 'admin_class' => null, 'document_class' => null, 'content_basepath' => '/cms/content', 'use_sonata_admin' => 'auto', - )); + ], + ], + ]); ``enabled`` ........... diff --git a/bundles/content/exposing_content_via_rest.rst b/bundles/content/exposing_content_via_rest.rst index 59c00b90..18b0d0ab 100644 --- a/bundles/content/exposing_content_via_rest.rst +++ b/bundles/content/exposing_content_via_rest.rst @@ -54,6 +54,7 @@ Here is an example configuration for the FOSRestBundle. .. code-block:: yaml + # app/config/config.yml fos_rest: # configure the view handler view: @@ -71,6 +72,7 @@ Here is an example configuration for the FOSRestBundle. .. code-block:: xml + @@ -98,38 +100,39 @@ Here is an example configuration for the FOSRestBundle. .. code-block:: php - $container->loadFromExtension('fos_rest', array( + // app/config/config.php + $container->loadFromExtension('fos_rest', [ // configure the view handler - 'view' => array( - 'force_redirects' => array( + 'view' => [ + 'force_redirects' => [ 'html' => true, - ), - 'formats' => array( + ], + 'formats' => [ 'json' => true, 'xml' => true, - ), - 'templating_formats' => array( + ], + 'templating_formats' => [ 'html' => true, - ), - ), + ], + ], // add a content negotiation rule, enabling support for json/xml for the entire website - 'format_listener' => array( - 'rules' => array( - array( + 'format_listener' => [ + 'rules' => [ + [ 'path' => '^/', - 'priorities' => array('html', 'json', 'xml'), + 'priorities' => ['html', 'json', 'xml'], 'fallback_format' => 'html', 'prefer_extension' => false, - ), - ), - ), - )); + ], + ], + ], + ]); Using the REST API ------------------ -After you configured the FOSRestBundle, you need to execute the following -commands: +This is all it takes to enable read support via JSON or XML! +Test if the setup works as expected with curl: .. code-block:: bash @@ -137,7 +140,6 @@ commands: curl http://my-cmf.org/app_dev.php -H Accept:application/xml curl http://my-cmf.org/app_dev.php -H Accept:text/html -This is all it takes to enable read support via JSON or XML! The JMS serializer comes with sensible defaults for Doctrine object mappers. However it might be necessary to add additional mapping to more tightly diff --git a/bundles/content/introduction.rst b/bundles/content/introduction.rst index 524f93e9..69cb10ac 100644 --- a/bundles/content/introduction.rst +++ b/bundles/content/introduction.rst @@ -140,9 +140,9 @@ To configure a default template, use the ``default_template`` option: // app/config/config.yml // ... - $container->loadFromExtension('cmf_content', array( + $container->loadFromExtension('cmf_content', [ 'default_template' => 'AppBundle:Content:static.html.twig', - )); + ]); Whenever the content controller gets called without a specified template, it will now use this template. @@ -187,16 +187,16 @@ Lets assume that you want to handle ``StaticContent`` with the default .. code-block:: php - // app/config/config.yml - + // app/config/config.php + use Symfony\Cmf\Bundle\ContentBundle\Doctrine\Phpcr\StaticContent; // ... - $container->loadFromExtension('cmf_routing', array( - 'dynamic' => array( - 'controller_by_class' => array( - 'Symfony\Cmf\Bundle\ContentBundle\Doctrine\Phpcr\StaticContent' => 'cmf_content.controller:indexAction', - ), - ), - )); + $container->loadFromExtension('cmf_routing', [ + 'dynamic' => [ + 'controller_by_class' => [ + StaticContent::class => 'cmf_content.controller:indexAction', + ], + ], + ]); Now everything is configured correctly, navigating to ``/hello`` results in a page displaying your content.