installation.rst 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. Installation
  2. ============
  3. Prerequisites
  4. -------------
  5. PHP 5.3 and Symfony 2 are needed to make this bundle work ; there are also some
  6. Sonata dependencies that need to be installed and configured beforehand :
  7. - `SonataCacheBundle <http://sonata-project.org/bundles/cache>`_
  8. - `SonataBlockBundle <http://sonata-project.org/bundles/block>`_
  9. - `SonatajQueryBundle <https://github.com/sonata-project/SonatajQueryBundle>`_
  10. - `KnpMenuBundle <https://github.com/KnpLabs/KnpMenuBundle/blob/master/Resources/doc/index.md#installation>`_ (Version 1.1.*)
  11. - `Exporter <https://github.com/sonata-project/exporter>`_
  12. You will need to install those in their 2.0 branches (or master if they don't
  13. have a similar branch). Follow also their configuration step ; you will find
  14. everything you need in their installation chapter.
  15. .. note::
  16. If a dependency is already installed somewhere in your project or in
  17. another dependency, you won't need to install it again.
  18. Translations
  19. ~~~~~~~~~~~~
  20. If you wish to use default translation texts provided in this bundle, you have
  21. to make sure you have translator enabled in your config.
  22. .. code-block:: yaml
  23. # app/config/config.yml
  24. framework:
  25. translator: ~
  26. Installation
  27. ------------
  28. Alter your deps file, and add these lines :
  29. .. code-block:: ini
  30. [SonataAdminBundle]
  31. git=git://github.com/sonata-project/SonataAdminBundle.git
  32. target=/bundles/Sonata/AdminBundle
  33. version=origin/2.0
  34. You will also need to alter your ``app/config/config.yml`` file :
  35. .. code-block:: yaml
  36. # app/config/config.yml
  37. sonata_block:
  38. default_contexts: [cms]
  39. blocks:
  40. sonata.admin.block.admin_list:
  41. contexts: [admin]
  42. sonata.block.service.text:
  43. sonata.block.service.action:
  44. sonata.block.service.rss:
  45. and finally run the vendors script to download bundles::
  46. php bin/vendors install
  47. Next, be sure to enable this bundle in your autoload.php (if it is not already
  48. in there) and AppKernel.php files:
  49. .. code-block:: php
  50. <?php
  51. // app/autoload.php
  52. $loader->registerNamespaces(array(
  53. // ...
  54. 'Sonata' => __DIR__.'/../vendor/bundles',
  55. // ...
  56. ));
  57. // app/AppKernel.php
  58. public function registerBundles()
  59. {
  60. return array(
  61. // ...
  62. new Sonata\AdminBundle\SonataAdminBundle(),
  63. // ...
  64. );
  65. }
  66. Now, install the assets from the bundles::
  67. php app/console assets:install web
  68. Usually when installing new bundles a good practice is to also delete your cache::
  69. php app/console cache:clear
  70. After you have successfully installed above bundles you need to configure
  71. SonataAdminBundle for administering your models. All that is needed to quickly
  72. set up SonataAdminBundle is described in the next chapter : :doc:`getting_started`.