installation.rst 2.6 KB

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