installation.rst 2.8 KB

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