1. Installation

1.1. Prerequisites (必須要件)

PHP 5.3 and Symfony 2 are needed to make this bundle work ; there are also some Sonata dependencies that need to be installed and configured beforehand :

このバンドルを動かすには、PHP 5.3とSymfony2 が必要です。またいくつかインストールして予め設定しておかなければならない、Sonata 依存性があります。

You will need to install those in their 2.0 branches (or master if they don’t have a similar branch). Follow also their configuration step ; you will find everything you need in their installation chapter.

あなたはこれらの2.0ブランチをインストールする必要があります。(もし似たようなブランチがなければマスターをインストールします) また、それらバンドルの設定方法に従ってください。それらのインストールの章で必要なことは全て見つかるでしょう。

Note

If a dependency is already installed somewhere in your project or in another dependency, you won’t need to install it again. もし依存が、プロジェクトや他の依存で既にインストールされていれば、改めてインストールする必要はありません

1.1.1. 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.

もし、このバンドルで提供されたデフォルト翻訳を使いたければ、configでtranslatorを有効にする必要があります。

# app/config/config.yml
framework:
    translator: ~

1.2. Installation (インストール)

Alter your deps file, and add these lines : depsを編集し、以下の行を追記します

[SonataAdminBundle]
    git=git://github.com/sonata-project/SonataAdminBundle.git
    target=/bundles/Sonata/AdminBundle
    version=origin/2.0

You will also need to alter your app/config/config.yml file :

また app/config/config.yml ファイルを編集する必要があります。

# 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

そして、vendors scriptを実行し、bundlesをダウンロードします。

php bin/vendors install

Next, be sure to enable this bundle in your autoload.php (if it is not already in there) and AppKernel.php files:

次に、このバンドルを有効にする為にautoload.php(もしまだ記述されて無ければ)とAppKernel.phpファイルに記述します。

<?php
// app/autoload.php
$loader->registerNamespaces(array(
    // ...
    'Sonata'     => __DIR__.'/../vendor/bundles',
    // ...
));

// app/AppKernel.php
public function registerBundles()
{
    return array(
        // ...
        new Sonata\AdminBundle\SonataAdminBundle(),
        // ...
    );
}

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 : Getting started with SonataAdminBundle (SonataAdminBundleのはじめ方).

上記のバンドルのインストールが成功した後は、モデルを管理する為にSonataAdminBundleを設定する必要があります。 次の章に書かれているSonataAdminBundleを素早くセットアップ方法で十分です。 : Getting started with SonataAdminBundle (SonataAdminBundleのはじめ方).