installation.rst 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. Installation
  2. ============
  3. Prerequisites
  4. -------------
  5. PHP 5.3 and Symfony 2 are needed to make this bundle work ; there are also some
  6. Sonata dependencies that need to be installed and configured beforehand :
  7. - `SonataCacheBundle <http://sonata-project.org/bundles/cache>`_
  8. - `SonataBlockBundle <http://sonata-project.org/bundles/block>`_
  9. - `SonatajQueryBundle <https://github.com/sonata-project/SonatajQueryBundle>`_
  10. - `KnpMenuBundle <https://github.com/KnpLabs/KnpMenuBundle/blob/master/Resources/doc/index.md#installation>`_ (Version 1.1.*)
  11. - `Exporter <https://github.com/sonata-project/exporter>`_
  12. You will need to install those in their 2.1 branches (or master if they don't
  13. have a similar branch). Also follow their configuration steps ; you will find
  14. everything you need in their installation chapter.
  15. .. note::
  16. If a dependency is already installed somewhere in your project or in
  17. another dependency, you won't need to install it again.
  18. Translations
  19. ~~~~~~~~~~~~
  20. If you wish to use default translation texts provided in this bundle, you have
  21. to make sure you have translator enabled in your config.
  22. .. code-block:: yaml
  23. # app/config/config.yml
  24. framework:
  25. translator: ~
  26. Installation
  27. ------------
  28. Download SonataAdminBundle and its dependencies to the ``vendor`` directory. You
  29. can use Composer for the automated process::
  30. php composer.phar require sonata-project/admin-bundle --no-update
  31. php composer.phar require sonata-project/doctrine-orm-admin-bundle --no-update # optional
  32. php composer.phar require sonata-project/intl-bundle --no-update # optional
  33. php composer.phar require sonata-project/cache-bundle --no-update # optional
  34. php composer.phar update
  35. Next, be sure to enable these bundles in your AppKernel.php file:
  36. .. code-block:: php
  37. // app/AppKernel.php
  38. public function registerBundles()
  39. {
  40. return array(
  41. // ...
  42. new Sonata\BlockBundle\SonataBlockBundle(),
  43. new Sonata\jQueryBundle\SonatajQueryBundle(),
  44. new Sonata\AdminBundle\SonataAdminBundle(),
  45. // ...
  46. );
  47. }
  48. You will also need to alter your ``app/config/config.yml`` file :
  49. .. code-block:: yaml
  50. # app/config/config.yml
  51. sonata_block:
  52. default_contexts: [cms]
  53. blocks:
  54. sonata.admin.block.admin_list:
  55. contexts: [admin]
  56. sonata.block.service.text: ~
  57. sonata.block.service.rss: ~
  58. Now, install the assets from the bundles:
  59. php app/console assets:install web
  60. Usually when installing new bundles it's good practice to also delete your cache::
  61. php app/console cache:clear
  62. After you have successfully installed the above bundles you need to configure
  63. SonataAdminBundle for administering your models. All that is needed to quickly
  64. set up SonataAdminBundle is described in the next chapter : :doc:`getting_started`.