installation.rst 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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. You will also need to alter your ``app/config/config.yml`` file :
  45. .. code-block:: yaml
  46. # app/config/config.yml
  47. sonata_block:
  48. default_contexts: [cms]
  49. blocks:
  50. sonata.admin.block.admin_list:
  51. contexts: [admin]
  52. sonata.block.service.text:
  53. sonata.block.service.action:
  54. sonata.block.service.rss:
  55. and finally run the vendors script to download bundles::
  56. php bin/vendors install
  57. Next, be sure to enable this bundles in your autoload.php and AppKernel.php
  58. files:
  59. .. code-block:: php
  60. <?php
  61. // app/autoload.php
  62. $loader->registerNamespaces(array(
  63. // ...
  64. 'Sonata' => __DIR__.'/../vendor/bundles',
  65. 'Exporter' => __DIR__.'/../vendor/exporter/lib',
  66. 'Knp\Bundle' => __DIR__.'/../vendor/bundles',
  67. 'Knp\Menu' => __DIR__.'/../vendor/knp/menu/src',
  68. // ...
  69. ));
  70. // app/AppKernel.php
  71. public function registerBundles()
  72. {
  73. return array(
  74. // ...
  75. new Sonata\AdminBundle\SonataAdminBundle(),
  76. new Sonata\BlockBundle\SonataBlockBundle(),
  77. new Sonata\CacheBundle\SonataCacheBundle(),
  78. new Sonata\jQueryBundle\SonatajQueryBundle(),
  79. new Knp\Bundle\MenuBundle\KnpMenuBundle(),
  80. // ...
  81. );
  82. }
  83. Now, install the assets from the bundles::
  84. php app/console assets:install web
  85. Usually when installing new bundles a good practice is to also delete your cache::
  86. php app/console cache:clear
  87. After you have successfully installed above bundles you need to configure
  88. SonataAdminBundle for administering your models. All that is needed to quickly
  89. set up SonataAdminBundle is described in the next chapter : :doc:`getting_started`.