sonata-project / SonataDoctrineORMAdminBundle

Integrate Doctrine ORM into the SonataAdminBundle
https://docs.sonata-project.org/projects/SonataDoctrineORMAdminBundle
MIT License
445 stars 345 forks source link

No metadata found for property in production #848

Closed franckentien closed 6 years ago

franckentien commented 6 years ago

Environment

Sonata packages

sonata-project/admin-bundle              3.38.3 3.38.3 The missing Symfony Admin Generator
sonata-project/block-bundle              3.12.1 3.12.1 Symfony SonataBlockBundle
sonata-project/cache                     2.0.1  2.0.1  Cache library
sonata-project/classification-bundle     3.7.1  3.7.1  Symfony SonataClassificationBundle
sonata-project/core-bundle               3.11.2 3.11.2 Symfony SonataCoreBundle
sonata-project/datagrid-bundle           2.3.1  2.3.1  Symfony SonataDatagridBundle
sonata-project/doctrine-extensions       1.0.2  1.0.2  Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.6.1  3.6.1  Symfony Sonata / Integrate Doctrine ORM into the SonataAdminB...
sonata-project/easy-extends-bundle       2.5.0  2.5.0  Symfony SonataEasyExtendsBundle
sonata-project/exporter                  1.9.1  1.9.1  Lightweight Exporter library
sonata-project/formatter-bundle          3.5.0  3.5.0  Symfony SonataFormatterBundle
sonata-project/intl-bundle               2.5.0  2.5.0  Symfony SonataIntlBundle
sonata-project/media-bundle              3.15.0 3.15.0 Symfony SonataMediaBundle
sonata-project/news-bundle               3.5.0  3.5.0  Symfony SonataNewsBundle
sonata-project/user-bundle               4.2.3  4.2.3  Symfony SonataUserBundle

Symfony packages

symfony/monolog-bundle    symfony/monolog-bundle     v3.3.0  v3.3.0 Symfony MonologBundle
symfony/phpunit-bridge     v3.4.15 v4.1.4 Symfony PHPUnit Bridge
symfony/polyfill-apcu      v1.9.0  v1.9.0 Symfony polyfill backporting apcu_* functions to lower PHP versions
symfony/polyfill-ctype     v1.9.0  v1.9.0 Symfony polyfill for ctype functions
symfony/polyfill-intl-icu  v1.9.0  v1.9.0 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-mbstring  v1.9.0  v1.9.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php56     v1.9.0  v1.9.0 Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions
symfony/polyfill-php70     v1.9.0  v1.9.0 Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions
symfony/polyfill-util      v1.9.0  v1.9.0 Symfony utilities for portability of PHP codes
symfony/security-acl       v3.0.1  v3.0.1 Symfony Security Component - ACL (Access Control List)
symfony/swiftmailer-bundle v2.6.7  v3.2.3 Symfony SwiftmailerBundle
symfony/symfony            v3.4.15 v4.1.4 The Symfony PHP framework

PHP version

PHP 7.2.5 (cli) (built: May  2 2018 09:36:24) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v10.1.1, Copyright (c) 2002-2017, by ionCube Ltd.
    with Zend OPcache v7.2.5, Copyright (c) 1999-2018, by Zend Technologies

Subject

I got an error when i deploy my website on production. I recently deployed my web site and i got an error with app.php but not with app_dev.php

Steps to reproduce

Connect to admin bundle and click on list of sonata bundle (Classification, User. Blog ...)

Expected results

The page will display with app.php like with app_dev.php

Actual results

Actually i got error 500 for each bundle but not for my personal admin view with production. It's work perfectly with app_dev.php

Sonata\DoctrineORMAdminBundle\Model\MissingPropertyMetadataException No metadata found for property Application\Sonata\ClassificationBundle\Entity\Collection::$context. Please make sure your Doctrine mapping is properly configured.

image

My Configurations files

...
# Doctrine Configuration
doctrine:
    dbal:

        driver: pdo_mysql
        host: '%database_host%'
        port: '%database_port%'
        dbname: '%database_name%'
        user: '%database_user%'
        password: '%database_password%'
        charset: UTF8
        # if using pdo_sqlite as your database driver:
        #   1. add the path in parameters.yml
        #     e.g. database_path: '%kernel.project_dir%/var/data/data.sqlite'
        #   2. Uncomment database_path in parameters.yml.dist
        #   3. Uncomment next line:
        #path: '%database_path%'
        types:
            json: Sonata\Doctrine\Types\JsonType
        server_version: 5.6

    orm:
        auto_generate_proxy_classes: "%kernel.debug%"
        auto_mapping: true

...
sonata_doctrine_orm_admin:
    # default value is null, so doctrine uses the value defined in the configuration
    entity_manager: ~

    audit:
        force: true

...

Thanks

franckentien commented 6 years ago

Solved the SonataEasyExtendsBundle was registered in dev only in the app kernel file.

tonyellow commented 4 years ago

Solved the SonataEasyExtendsBundle was registered in dev only in the app kernel file.

This saved my day