diff --git a/docs/reference/installation.rst b/docs/reference/installation.rst index 864618313..983a6c03b 100644 --- a/docs/reference/installation.rst +++ b/docs/reference/installation.rst @@ -7,7 +7,8 @@ Installation Prerequisites ------------- -PHP 7 and Symfony 2.8 or 3 are needed to make this bundle work; there are also some Sonata dependencies that need to be installed and configured beforehand: +PHP 7 and Symfony 2.8, >=3.3 or 4 are needed to make this bundle work, there are +also some Sonata dependencies that need to be installed and configured beforehand: - `SonataAdminBundle `_ - `SonataEasyExtendsBundle `_ @@ -25,14 +26,35 @@ Enable the Bundle .. code-block:: bash - php composer.phar require sonata-project/user-bundle --no-update - php composer.phar require sonata-project/doctrine-orm-admin-bundle --no-update # optional - php composer.phar require friendsofsymfony/rest-bundle --no-update # optional when using api - php composer.phar require nelmio/api-doc-bundle --no-update # optional when using api - php composer.phar require sonata-project/google-authenticator --no-update # optional - php composer.phar update + composer require sonata-project/user-bundle --no-update + composer require sonata-project/doctrine-orm-admin-bundle --no-update # optional + composer require friendsofsymfony/rest-bundle --no-update # optional when using api + composer require nelmio/api-doc-bundle --no-update # optional when using api + composer require sonata-project/google-authenticator --no-update # optional + composer update -Next, be sure to enable the bundles in your and ``AppKernel.php`` file: +Next, be sure to enable the bundles in your ``bundles.php`` file if they +are not already enabled: + +.. code-block:: php + + ['all' => true], + Sonata\CoreBundle\SonataCoreBundle::class => ['all' => true], + Sonata\BlockBundle\SonataBlockBundle::class => ['all' => true], + Sonata\EasyExtendsBundle\SonataEasyExtendsBundle::class => ['all' => true], + FOS\UserBundle\FOSUserBundle::class => ['all' => true], + Sonata\UserBundle\SonataUserBundle::class => ['all' => true], + ]; + +.. note:: + If you are not using Symfony Flex, you should enable bundles in your + ``AppKernel.php``. .. code-block:: php @@ -42,7 +64,7 @@ Next, be sure to enable the bundles in your and ``AppKernel.php`` file: public function registerbundles() { - return array( + return [ new Sonata\AdminBundle\SonataAdminBundle(), new Sonata\CoreBundle\SonataCoreBundle(), new Sonata\BlockBundle\SonataBlockBundle(), @@ -51,29 +73,33 @@ Next, be sure to enable the bundles in your and ``AppKernel.php`` file: new FOS\UserBundle\FOSUserBundle(), new Sonata\UserBundle\SonataUserBundle(), // ... - ); + ]; } Configuration ------------- -When using ACL, the ``UserBundle`` can prevent `normal` user to change settings of `super-admin` users, to enable this add to the configuration: + +.. note:: + If you are not using Symfony Flex, all configuration in this section should + be added to ``app/config/config.yml``. + +ACL Configuration +~~~~~~~~~~~~~~~~~ +When using ACL, the ``UserBundle`` can prevent `normal` users to change +settings of `super-admin` users, to enable this use the following configuration: .. code-block:: yaml - # app/config/config.yml + # config/packages/sonata.yaml sonata_user: security_acl: true manager_type: orm # can be orm or mongodb - sonata_block: - blocks: - #... - sonata.user.block.menu: # used to display the menu in profile pages - sonata.user.block.account: # used to display menu option (login option) - sonata.block.service.text: # used to if you plan to use Sonata user routes +.. code-block:: yaml + + # config/packages/security.yaml - # app/config/security.yml security: # [...] @@ -86,26 +112,14 @@ When using ACL, the ``UserBundle`` can prevent `normal` user to change settings Doctrine Configuration ~~~~~~~~~~~~~~~~~~~~~~ -Add these config lines +Add these config lines to your Doctrine configuration: .. code-block:: yaml - # app/config/config.yml - - fos_user: - db_driver: orm # can be orm or odm - firewall_name: main - user_class: Sonata\UserBundle\Entity\BaseUser - - - group: - group_class: Sonata\UserBundle\Entity\BaseGroup - group_manager: sonata.user.orm.group_manager # If you're using doctrine orm (use sonata.user.mongodb.group_manager for mongodb) - - service: - user_manager: sonata.user.orm.user_manager # If you're using doctrine orm (use sonata.user.mongodb.user_manager for mongodb) + # config/packages/doctrine.yaml doctrine: + #... dbal: types: json: Sonata\Doctrine\Types\JsonType @@ -115,16 +129,42 @@ And these in the config mapping definition (or enable `auto_mapping ['all' => true], + ]; - ) - } - } +.. note:: + If you are not using Symfony Flex, add the new ``Application`` Bundle into your + ``AppKernel.php``. + +.. code-block:: php + +