installation.rst 2.8 KB

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