123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- Installation
- ============
- Prerequisites
- -------------
- **Translations.**
- If you wish to use default translation texts provided in this bundle, you have
- to make sure you have translator enabled in your config.
- .. code-block:: yaml
- # app/config/config.yml
- framework:
- translator: ~
- Installation
- ------------
- Download SonataAdminBundle and its dependencies to the ``vendor`` directory. You
- can use the Symfony's vendor script for the automated procces. Add the following
- in your ``deps`` file:
- .. code-block:: ini
- [SonataAdminBundle]
- git=git://github.com/sonata-project/SonataAdminBundle.git
- target=/bundles/Sonata/AdminBundle
- version=origin/2.0
- [SonataBlockBundle]
- git=git://github.com/sonata-project/SonataBlockBundle.git
- target=/bundles/Sonata/BlockBundle
- version=origin/2.0
- [SonataCacheBundle]
- git=git://github.com/sonata-project/SonataCacheBundle.git
- target=/bundles/Sonata/CacheBundle
- version=origin/2.0
- [SonatajQueryBundle]
- git=http://github.com/sonata-project/SonatajQueryBundle.git
- target=/bundles/Sonata/jQueryBundle
- [KnpMenuBundle]
- git=http://github.com/KnpLabs/KnpMenuBundle.git
- target=/bundles/Knp/Bundle/MenuBundle
- [KnpMenu]
- git=http://github.com/KnpLabs/KnpMenu.git
- target=/knp/menu
- [Exporter]
- git=http://github.com/sonata-project/exporter.git
- target=/exporter
- You will also need to alter your ``app/config/config.yml`` file :
- .. code-block:: yaml
- # app/config/config.yml
- sonata_block:
- default_contexts: [cms]
- blocks:
- sonata.admin.block.admin_list:
- contexts: [admin]
- sonata.block.service.text:
- sonata.block.service.action:
- sonata.block.service.rss:
- and finally run the vendors script to download bundles::
- php bin/vendors install
- Next, be sure to enable this bundles in your autoload.php and AppKernel.php
- files:
- .. code-block:: php
- <?php
- // app/autoload.php
- $loader->registerNamespaces(array(
- // ...
- 'Sonata' => __DIR__.'/../vendor/bundles',
- 'Exporter' => __DIR__.'/../vendor/exporter/lib',
- 'Knp\Bundle' => __DIR__.'/../vendor/bundles',
- 'Knp\Menu' => __DIR__.'/../vendor/knp/menu/src',
- // ...
- ));
- // app/AppKernel.php
- public function registerBundles()
- {
- return array(
- // ...
- new Sonata\AdminBundle\SonataAdminBundle(),
- new Sonata\BlockBundle\SonataBlockBundle(),
- new Sonata\CacheBundle\SonataCacheBundle(),
- new Sonata\jQueryBundle\SonatajQueryBundle(),
- new Knp\Bundle\MenuBundle\KnpMenuBundle(),
- // ...
- );
- }
- Now, install the assets from the bundles::
- php app/console assets:install web
- Usually when installing new bundles a good practice is to also delete your cache::
- php app/console cache:clear
- After you have successfully installed above bundles you need to configure
- SonataAdminBundle for administering your models. All that is needed to quickly
- set up SonataAdminBundle is described in the next chapter : :doc:`getting_started`.
|