installation.rst 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 Composer for the automated procces.
  16. php composer.phar require sonata-project/admin-bundle
  17. php composer.phar install
  18. Next, be sure to enable this bundles in your AppKernel.php file:
  19. .. code-block:: php
  20. <?php
  21. // app/AppKernel.php
  22. public function registerBundles()
  23. {
  24. return array(
  25. // ...
  26. new Sonata\AdminBundle\SonataAdminBundle(),
  27. new Sonata\BlockBundle\SonataBlockBundle(),
  28. new Sonata\CacheBundle\SonataCacheBundle(),
  29. new Sonata\jQueryBundle\SonatajQueryBundle(),
  30. new Knp\Bundle\MenuBundle\KnpMenuBundle(),
  31. // ...
  32. );
  33. }
  34. If you didn't use Composer, you also need to add the bundle namespaces to your
  35. autoload.php:
  36. .. code-block:: php
  37. <?php
  38. // app/autoload.php
  39. $loader->registerNamespaces(array(
  40. // ...
  41. 'Sonata' => __DIR__.'/../vendor/bundles',
  42. 'Exporter' => __DIR__.'/../vendor/exporter/lib',
  43. 'Knp\Bundle' => __DIR__.'/../vendor/bundles',
  44. 'Knp\Menu' => __DIR__.'/../vendor/knp/menu/src',
  45. // ...
  46. ));
  47. Now, install the assets from the bundles:
  48. php app/console assets:install web
  49. Usually when installing new bundles a good practice is also to delete your cache:
  50. php app/console cache:clear
  51. After you have successfully installed above bundles you need to configure
  52. SonataAdminBundle for administering your models. All that is needed to quickly
  53. set up SonataAdminBundle is described in the next chapter the Getting started
  54. with SonataAdminBundle.