php - 找不到属性 Application\Sonata\NewsBundle\Entity\P

我安装了 SonataNews Bundle 并将其扩展为 ApplicationSonataNewsBundle。

当我转到 /app_dev.php/admin/sonata/news/post/list

我有问题消息

No metadata found for property Application\Sonata\NewsBundle\Entity\Post::$tags. Please make sure your Doctrine mapping is properly configured.
500 Internal Server Error - MissingPropertyMetadataException

有人可以帮助我吗?

环境

Symfony 2.8

  sonata-project/admin-bundle 3.23.0 The missing Symfony Admin
    Generator sonata-project/block-bundle 3.3.2 Symfony
    SonataBlockBundle sonata-project/cache 1.0.7 Cache library
    sonata-project/cache-bundle 2.3.1 This bundle provides caching
    services sonata-project/classification-bundle 3.3.1 Symfony
    SonataClassificationBundle sonata-project/core-bundle 3.4.0 Symfony
    SonataCoreBundle sonata-project/datagrid-bundle 2.2.1 Symfony
    SonataDatagridBundle sonata-project/doctrine-extensions 1.0.2
    Doctrine2 behavioral extensions
    sonata-project/doctrine-orm-admin-bundle 3.1.6 Symfony Sonata /
    Integrate Doctrine ORM into the SonataAdminBundle
    sonata-project/easy-extends-bundle 2.2.0 Symfony
    SonataEasyExtendsBundle sonata-project/exporter 1.7.1 Lightweight
    Exporter library sonata-project/formatter-bundle 3.2.2 Symfony
    SonataFormatterBundle sonata-project/google-authenticator 1.1.0
    Library to integrate Google Authenticator into a PHP project
    sonata-project/intl-bundle 2.3.1 Symfony SonataIntlBundle
    sonata-project/media-bundle 3.6.0 Symfony SonataMediaBundle
    sonata-project/news-bundle 3.1.2 Symfony SonataNewsBundle
    sonata-project/notification-bundle 3.1.0 Symfony
    SonataNotificationBundle sonata-project/page-bundle 3.5.1 This
    bundle provides a Site and Page management through container and
    block services sonata-project/seo-bundle 2.2.0 Symfony
    SonataSeoBundle sonata-project/translation-bundle 2.1.1
    SonataTranslationBundle sonata-project/user-bundle 3.2.4 Symfony
    SonataUserBundle

Symfony 包

symfony/assetic-bundle v2.8.2 Integrates Assetic into Symfony2
symfony/monolog-bundle v3.1.0 Symfony MonologBundle
symfony/phpunit-bridge v2.8.27 Symfony PHPUnit Bridge
symfony/polyfill-apcu v1.5.0 Symfony polyfill backporting apcu_* functions to lower PHP versions
symfony/polyfill-intl-icu v1.5.0 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-mbstring v1.5.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php54 v1.5.0 Symfony polyfill backporting some PHP 5.4+ features to lower PHP versions
symfony/polyfill-php55 v1.5.0 Symfony polyfill backporting some PHP 5.5+ features to lower PHP versions
symfony/polyfill-php56 v1.5.0 Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions
symfony/polyfill-php70 v1.5.0 Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions
symfony/polyfill-util v1.5.0 Symfony utilities for portability of PHP codes
symfony/security-acl v2.8.0 Symfony Security Component - ACL (Access Control List)
symfony/swiftmailer-bundle v2.6.3 Symfony SwiftmailerBundle
symfony/symfony v2.8.27 The Symfony PHP framework

PHP 版本

PHP 7.0.19

最佳答案

我有类似的问题,在我的情况下,这是由于类配置。在 Sf DI 期间注入(inject)了映射,但找不到我的自定义用户类。

只需检查 News Bundle 使用的类。

sonata_news:
    class:
        post:       Application\Sonata\NewsBundle\Entity\Post
        comment:    Application\Sonata\NewsBundle\Entity\Comment
        media:      Application\Sonata\MediaBundle\Entity\Media
        user:       My\Custom\UserBundle\Entity\User

关于php - 找不到属性 Application\Sonata\NewsBundle\Entity\Post::$tags 的元数据。请确保你的 Doctrine 映射配置正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46201012/

相关文章:

java - 反编译MCP报错(9.18版)返回 'Decompile Failed' 1

dataframe - 通过 [PySpark] 列连接两个 DataFrame

html - 样式对象的内容/嵌入

jekyll - 如何使用 Jekyll 将 CSS 导入 SCSS 文件?

php - 第 0 行未知中的警告 : Unknown: Failed to write sessi

azure - Azure WebApp 是否自动进行速率限制/DOS 保护?

reactjs - reactjs 应用程序中的全局 SASS 变量

google-cloud-platform - Google Cloud Endpoints 以 V

string - 如何删除大括号之间的文本

asp.net-mvc - ASP.NET Core 模型状态不返回 DataMember 名称