Vich 上传器bundle:映射不存在



我需要帮助,以找出为什么不存在VichuploaderBundle映射。我使用的是easyadmin和orm学说的vichuploaderbundle。我的vich_uploader.yaml文件

vich_uploader:
    db_driver: orm
    mappings:
        products:
            #uri_prefix: '%app.path.node_images%'
            uri_prefix: '%app.path.product_images%'
             #uri_prefix: /products
            #upload_destination: '%kernel.root_dir%/../web%app.path.node_images%'
            upload_destination: '%kernel.root_dir%/../web/%app.path.product_images%'   

类调试说映射在那里

root@92d9f528832e:/app# php bin/console vich:mapping:debug-class 
App\Entity\Node
Introspecting class AppEntityNode:
Found field "imageFile", storing file name in "image" and using mapping 
"product_images"

但是映射调试器找不到它

root@92d9f528832e:/app# php bin/console vich:mapping:debug 
product_images
In MappingDebugCommand.php line 37:                                     
Mapping "product_images" does not exist.

这是我的班级

namespace AppEntity;
use DoctrineORMMapping as ORM;
use SymfonyComponentHttpFoundationFileFile;
use VichUploaderBundleMappingAnnotation as Vich;
/**
 * @ORMEntity
 * @ORMTable(name="nodes")
 * @ORMEntity(repositoryClass="AppRepositoryNodeRepository")
 * @VichUploadable
 */
class Node
{
    /**
     * @VichUploadableField(mapping="product_images", fileNameProperty="image")
     *
     * @var File
     */
    private $imageFile;
    /**
     * @ORMColumn(type="datetime")
     * @var DateTime
     */

这是我的学说安装输出:

  doctrine/annotations                v1.6.0             Docblock Annotations Parser
  doctrine/cache                      v1.8.0             Caching library offering an object-oriented API for many cache backends
  doctrine/collections                v1.5.0             Collections Abstraction library
  doctrine/common                     v2.10.0            PHP Doctrine Common project is a library that provides additional functi...
  doctrine/dbal                       v2.8.0             Database Abstraction Layer
  doctrine/doctrine-bundle            1.10.0             Symfony DoctrineBundle
  doctrine/doctrine-cache-bundle      1.3.5              Symfony Bundle for Doctrine Cache
  doctrine/doctrine-migrations-bundle v1.3.1             Symfony DoctrineMigrationsBundle
  doctrine/event-manager              v1.0.0             Doctrine Event Manager component
  doctrine/inflector                  v1.3.0             Common String Manipulations with regard to casing and singular/plural ru...
  doctrine/instantiator               1.1.0              A small, lightweight utility to instantiate objects in PHP without invok...
  doctrine/lexer                      v1.0.1             Base library for a lexer that can be used in Top-Down, Recursive Descent...
  doctrine/migrations                 v1.8.1             Database Schema migrations using Doctrine DBAL
  doctrine/orm                        v2.6.3             Object-Relational-Mapper for PHP
  doctrine/persistence                v1.1.0             The Doctrine Persistence project is a set of shared interfaces and funct...
  doctrine/reflection                 v1.0.0             Doctrine Reflection component
  opsway/doctrine-dbal-postgresql     v0.8.1             Extensions for support Postgres in Doctrine DBAL & DQL
  symfony/doctrine-bridge             v4.2.0             Symfony Doctrine Bridge
vich/uploader-bundle                1.8.5

我错误地命名了映射"产品",而不是" product_images"。

最新更新