简体   繁体   English

Vich Uploader捆绑包:映射不存在

[英]Vich uploader bundle: mapping doesn't exist

I need help to figure out why a VichUploaderBundle mapping doesn't exist. 我需要帮助以找出为什么VichUploaderBundle映射不存在。 I'm using VichUploaderBundle with EasyAdmin and ORM doctrine. 我正在使用带有EasyAdmin和ORM原则的VichUploaderBundle。 My vich_uploader.yaml file 我的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%'   

Class debugging says the mapping is there 类调试表明存在映射

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

But mapping debugger can't find it 但是映射调试器找不到

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

Here's my class 这是我的课

namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;

/**
 * @ORM\Entity
 * @ORM\Table(name="nodes")
 * @ORM\Entity(repositoryClass="App\Repository\NodeRepository")
 * @Vich\Uploadable
 */
class Node
{
    /**
     * @Vich\UploadableField(mapping="product_images", fileNameProperty="image")
     *
     * @var File
     */
    private $imageFile;
    /**
     * @ORM\Column(type="datetime")
     * @var \DateTime
     */

Here is my doctrine installation output: 这是我的学说安装输出:

  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”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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