0

私はSymfony2を学びます。SonataAdminBundleの例を示したいと思います。私が見つけた:

http://sonata-project.org/bundles/news/2-0/doc/reference/installation.html

しかし、これは最初のポイントではありません。私が見つけた:

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

[SonataBlockBundle]
    git=http://github.com/sonata-project/SonataBlockBundle.git
    target=/bundles/Sonata/BlockBundle

[SonataCacheBundle]
    git=http://github.com/sonata-project/SonataCacheBundle.git
    target=/bundles/Sonata/CacheBundle

[SonatajQueryBundle]
    git=http://github.com/sonata-project/SonatajQueryBundle.git
    target=/bundles/Sonata/jQueryBundle

[SonataDoctrineORMAdminBundle]
    git=http://github.com/sonata-project/SonataDoctrineORMAdminBundle.git
    target=/bundles/Sonata/DoctrineORMAdminBundle

[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

[SonataNewsBundle]
    git=http://github.com/sonata-project/SonataNewsBundle.git
    target=/bundles/Sonata/NewsBundle

bin/installベンダーを実行します。。インストールは正しいです。AppKernelとautoloadに行を追加しました。実行すると、次のようになります。

php app/console sonata:easy-extends:generate SonataNewsBundle

エラーがあります:

[InvalidArgumentException]
バンドル「ApplicationSonataNewsBundle」が存在しないか、有効になっていません。

だから私は追加しました:

new Application\Sonata\NewsBundle\ApplicationSonataNewsBundle(),

実行します

php app/console sonata:easy-extends:generate SonataNewsBundle

それから私はエラーがあります:

PHPの致命的なエラー:クラス'Application \ Sonata \ NewsBundle\ApplicationSonataNewsBundle'が/home/lanox06/Projects/sym2/app/AppKernel.phpの29行目に見つかりません

どうすればこれを作ることができますか?これらのアプリケーションをテストしたいと思います。

4

2 に答える 2

2

./app/Applicationフォルダをから./appディレクトリに移動する必要があります./src

于 2012-05-11T16:27:46.633 に答える
1

他の解決策は、次のように--dest=srcオプションを追加することです。

php app/console sonata:easy-extends:generate --dest=src SonataNewsBundle
于 2013-07-04T19:38:10.303 に答える