简体   繁体   中英

symfony2 sonata page bundle error

How to install sonata page-bundle?

My composer.json:

"require": {
    "php": ">=5.3.3",
    "symfony/symfony": "2.3.*",
    "doctrine/orm": ">=2.2.3,<2.4-dev",

    "doctrine/doctrine-bundle": "~1.2",
    "doctrine/doctrine-migrations-bundle": "dev-master",
    "doctrine/migrations": "dev-master",
    "doctrine/doctrine-fixtures-bundle": "~2.2",
    "doctrine/data-fixtures": "1.0.*@dev",

    "twig/extensions": "1.0.*",
    "symfony/assetic-bundle": "2.3.*",
    "symfony/swiftmailer-bundle": "2.3.*",
    "symfony/monolog-bundle": "2.3.*",
    "sensio/distribution-bundle": "2.3.*",
    "sensio/framework-extra-bundle": "2.3.*",
    "sensio/generator-bundle": "2.3.*",
    "incenteev/composer-parameter-handler": "~2.0",

    "jms/security-extra-bundle": "1.5.*",
    "jms/di-extra-bundle": "1.4.*",

    "kriswallsmith/assetic": "1.1.0",
    "liip/imagine-bundle": "dev-master",
    "egeloen/ckeditor-bundle": "2.*",

    "symfony-cmf/routing-bundle": "~1.1",

    "knplabs/knp-markdown-bundle": "1.2.*@dev",

    "sonata-project/easy-extends-bundle": "~2.1",
    "sonata-project/seo-bundle": "~1",
    "sonata-project/doctrine-extensions": "~1",
    "sonata-project/intl-bundle": "~2.1",
    "sonata-project/admin-bundle": "~2.2",
    "sonata-project/doctrine-orm-admin-bundle": "~2.2",
    "sonata-project/notification-bundle": "~2.2",
    "sonata-project/block-bundle": "~2.2",
    "sonata-project/media-bundle": "~2.2",
    "sonata-project/cache-bundle": "~2.1",
    "sonata-project/page-bundle": "~2.3",
    "sonata-project/formatter-bundle": "~2.3",
    "sonata-project/exporter": "~1.3",
    "sonata-project/classification-bundle": "~2.2",

    "dflydev/markdown": "~1.0",
    "simplethings/entity-audit-bundle": "~0.5",
    "willdurand/faker-bundle": "~1.0",
    "stof/doctrine-extensions-bundle": "~1.1"
},

My AppKernel.php:

        new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
        new Symfony\Bundle\SecurityBundle\SecurityBundle(),
        new Symfony\Bundle\TwigBundle\TwigBundle(),
        new Symfony\Bundle\MonologBundle\MonologBundle(),
        new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
        new Symfony\Bundle\AsseticBundle\AsseticBundle(),
        new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),

    new JMS\AopBundle\JMSAopBundle(),
    new JMS\DiExtraBundle\JMSDiExtraBundle($this),
    new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),

        // DOCTRINE
        new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
        new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),

        // KNP HELPER BUNDLES
        // new Knp\Bundle\MenuBundle\KnpMenuBundle(),
        new Knp\Bundle\MarkdownBundle\KnpMarkdownBundle(),

        // MEDIA
        new Sonata\MediaBundle\SonataMediaBundle(),
        new Application\Sonata\MediaBundle\ApplicationSonataMediaBundle(),
        new Liip\ImagineBundle\LiipImagineBundle(),

        // SONATA CORE & HELPER BUNDLES
        new Sonata\EasyExtendsBundle\SonataEasyExtendsBundle(),
        new Sonata\jQueryBundle\SonatajQueryBundle(),
        new Sonata\AdminBundle\SonataAdminBundle(),
        new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
        new Sonata\IntlBundle\SonataIntlBundle(),
        new Sonata\FormatterBundle\SonataFormatterBundle(),
        new Sonata\CacheBundle\SonataCacheBundle(),
        new Sonata\BlockBundle\SonataBlockBundle(),
        new Sonata\SeoBundle\SonataSeoBundle(),
        new Sonata\PageBundle\SonataPageBundle(),
        new Application\Sonata\PageBundle\ApplicationSonataPageBundle(),
        new Sonata\ClassificationBundle\SonataClassificationBundle(),
        new Application\Sonata\ClassificationBundle\ApplicationSonataClassificationBundle(),
        new Sonata\NotificationBundle\SonataNotificationBundle(),
        new Application\Sonata\NotificationBundle\ApplicationSonataNotificationBundle(),

        // CMF Integration
        new Symfony\Cmf\Bundle\RoutingBundle\CmfRoutingBundle(),

        new Knp\Bundle\MenuBundle\KnpMenuBundle(),
        new Ivory\CKEditorBundle\IvoryCKEditorBundle(),

And when i create "block" found error:

Catchable Fatal Error: Argument 3 passed to Sonata\DoctrineORMAdminBundle\Block\AuditBlockService::__construct() must be an instance of SimpleThings\EntityAudit\AuditReader, null given, called in /var/www/xxx/app/cache/dev/appDevDebugProjectContainer.php on line 4911 and defined in /var/www/xxx/vendor/sonata-project/doctrine-orm-admin-bundle/Sonata/DoctrineORMAdminBundle/Block/AuditBlockService.php line 40 

After then, add " SimpleThings\\EntityAudit\\SimpleThingsEntityAuditBundle() " to AppKernel, and found:

ContextErrorException: Notice: Uninitialized string offset: 0 in /var/www/xxx/vendor/sonata-project/doctrine-orm-admin-bundle/Sonata/DoctrineORMAdminBundle/DependencyInjection/Compiler/AddAuditEntityCompilerPass.php line 63

What is wrong?

When installing SonataPageBundle, you have a set of dependencies that need to be installed and properly configured, see the list here: http://sonata-project.org/bundles/page/master/doc/reference/installation.html

You need to check out the installation steps of each specified bundle.

For the details:

The SimpleThingsEntityAuditBundle is used by the DoctrineORMAdminBundle to automatically audit the doctrine-managed entities that have an admin interface.

There it seems that you've created an admin class (a service tagged "sonata.admin") without specifying the needed arguments for the admin (or without inheriting the default admin).

If you didn't, try clearing your cache:

rm -rf app/cache/*

You may have an outdated container.

If this doesn't work, check your services tagged "sonata.admin" to see if they have the required arguments.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM