installation.rst 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. .. code-block:: ini
  18. [SonataAdminBundle]
  19. git=http://github.com/sonata-project/SonataAdminBundle.git
  20. target=/bundles/Sonata/AdminBundle
  21. [SonataBlockBundle]
  22. git=http://github.com/sonata-project/SonataBlockBundle.git
  23. target=/bundles/Sonata/BlockBundle
  24. [SonataCacheBundle]
  25. git=http://github.com/sonata-project/SonataCacheBundle.git
  26. target=/bundles/Sonata/CacheBundle
  27. [SonatajQueryBundle]
  28. git=http://github.com/sonata-project/SonatajQueryBundle.git
  29. target=/bundles/Sonata/jQueryBundle
  30. [KnpMenuBundle]
  31. git=http://github.com/KnpLabs/KnpMenuBundle.git
  32. target=/bundles/Knp/Bundle/MenuBundle
  33. [KnpMenu]
  34. git=http://github.com/KnpLabs/KnpMenu.git
  35. target=/knp/menu
  36. [Exporter]
  37. git=http://github.com/sonata-project/exporter.git
  38. target=/exporter
  39. and run the vendors script to download bundles::
  40. php bin/vendors install
  41. Next, be sure to enable this bundles in your autoload.php and AppKernel.php
  42. files:
  43. .. code-block:: php
  44. <?php
  45. // app/autoload.php
  46. $loader->registerNamespaces(array(
  47. // ...
  48. 'Sonata' => __DIR__.'/../vendor/bundles',
  49. 'Exporter' => __DIR__.'/../vendor/exporter/lib',
  50. 'Knp\Bundle' => __DIR__.'/../vendor/bundles',
  51. 'Knp\Menu' => __DIR__.'/../vendor/knp/menu/src',
  52. // ...
  53. ));
  54. // app/AppKernel.php
  55. public function registerBundles()
  56. {
  57. return array(
  58. // ...
  59. new Sonata\AdminBundle\SonataAdminBundle(),
  60. new Sonata\BlockBundle\SonataBlockBundle(),
  61. new Sonata\CacheBundle\SonataCacheBundle(),
  62. new Sonata\jQueryBundle\SonatajQueryBundle(),
  63. new Knp\Bundle\MenuBundle\KnpMenuBundle(),
  64. // ...
  65. );
  66. }
  67. Now, install the assets from the bundles::
  68. php app/console assets:install web
  69. Usually when installing new bundles a good practice is also to delete your cache::
  70. php app/console cache:clear
  71. After you have successfully installed above bundles you need to configure
  72. SonataAdminBundle for administering your models. All that is needed to quickly
  73. set up SonataAdminBundle is described in the next chapter the Getting started
  74. with SonataAdminBundle.