installation.rst 3.1 KB

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