installation.rst 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. Installation
  2. ============
  3. Prerequisites
  4. -------------
  5. **Translations**
  6. If you wish to use default translation texts provided in this bundle, you have
  7. to make sure you have translator enabled in your config.
  8. .. code-block:: yaml
  9. # app/config/config.yml
  10. framework:
  11. translator: ~
  12. Installation
  13. ------------
  14. Download SonataAdminBundle and its dependencies to the ``vendor`` directory. You
  15. can use the Symfony's vendor script for the automated procces. Add the following
  16. in your ``deps`` file::
  17. [SonataAdminBundle]
  18. git=http://github.com/sonata-project/SonataAdminBundle.git
  19. target=/bundles/Sonata/AdminBundle
  20. [SonataBlockBundle]
  21. git=http://github.com/sonata-project/SonataBlockBundle.git
  22. target=/bundles/Sonata/BlockBundle
  23. [SonataCacheBundle]
  24. git=http://github.com/sonata-project/SonataCacheBundle.git
  25. target=/bundles/Sonata/CacheBundle
  26. [SonatajQueryBundle]
  27. git=http://github.com/sonata-project/SonatajQueryBundle.git
  28. target=/bundles/Sonata/jQueryBundle
  29. [KnpMenuBundle]
  30. git=http://github.com/KnpLabs/KnpMenuBundle.git
  31. target=/bundles/Knp/Bundle/MenuBundle
  32. [KnpMenu]
  33. git=http://github.com/KnpLabs/KnpMenu.git
  34. target=/knp/menu
  35. [Exporter]
  36. git=http://github.com/sonata-project/exporter.git
  37. target=/exporter
  38. and run the vendors script to download bundles::
  39. php bin/vendors install
  40. Next, be sure to enable this bundles in your autoload.php and AppKernel.php
  41. files:
  42. .. code-block:: php
  43. <?php
  44. // app/autoload.php
  45. $loader->registerNamespaces(array(
  46. // ...
  47. 'Sonata' => __DIR__.'/../vendor/bundles',
  48. 'Exporter' => __DIR__.'/../vendor/exporter/lib',
  49. 'Knp\Bundle' => __DIR__.'/../vendor/bundles',
  50. 'Knp\Menu' => __DIR__.'/../vendor/knp/menu/src',
  51. // ...
  52. ));
  53. // app/AppKernel.php
  54. public function registerBundles()
  55. {
  56. return array(
  57. // ...
  58. new Sonata\AdminBundle\SonataAdminBundle(),
  59. new Sonata\BlockBundle\SonataBlockBundle(),
  60. new Sonata\CacheBundle\SonataCacheBundle(),
  61. new Sonata\jQueryBundle\SonatajQueryBundle(),
  62. new Knp\Bundle\MenuBundle\KnpMenuBundle(),
  63. // ...
  64. );
  65. }
  66. Now, install the assets from the bundles:
  67. ``php app/console assets:install web``.
  68. Usually when installing new bundles a good practice is also to delete your cache:
  69. ``php app/console cache:clear``.
  70. After you have successfully installed above bundles you need to configure
  71. SonataAdminBundle for administering your models. All that is needed to quickly
  72. set up SonataAdminBundle is described in the next chapter the Getting started
  73. with SonataAdminBundle.