installation.rst 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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). Follow also their configuration step ; 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 procces.
  30. php composer.phar require sonata-project/admin-bundle
  31. Next, be sure to enable this bundles in your AppKernel.php file:
  32. .. code-block:: php
  33. // app/AppKernel.php
  34. public function registerBundles()
  35. {
  36. return array(
  37. // ...
  38. new Sonata\BlockBundle\SonataBlockBundle(),
  39. new Sonata\CacheBundle\SonataCacheBundle(),
  40. new Sonata\jQueryBundle\SonatajQueryBundle(),
  41. new Sonata\AdminBundle\SonataAdminBundle(),
  42. // ...
  43. );
  44. }
  45. You will also need to alter your ``app/config/config.yml`` file :
  46. .. code-block:: yaml
  47. # app/config/config.yml
  48. sonata_block:
  49. default_contexts: [cms]
  50. blocks:
  51. sonata.admin.block.admin_list:
  52. contexts: [admin]
  53. sonata.block.service.text:
  54. sonata.block.service.action:
  55. sonata.block.service.rss:
  56. Now, install the assets from the bundles:
  57. php app/console assets:install web
  58. Usually when installing new bundles a good practice is to also delete your cache::
  59. php app/console cache:clear
  60. After you have successfully installed above bundles you need to configure
  61. SonataAdminBundle for administering your models. All that is needed to quickly
  62. set up SonataAdminBundle is described in the next chapter : :doc:`getting_started`.