Пакет загрузчика Vich: отображение не существует - PullRequest
0 голосов
/ 17 декабря 2018

Мне нужна помощь, чтобы выяснить, почему не существует отображение VichUploaderBundle.Я использую VichUploaderBundle с доктриной EasyAdmin и ORM.Мой файл 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 App\Entity\Node:
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 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
     */

Вот мой вывод установки доктрины:

  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

1 Ответ

0 голосов
/ 17 декабря 2018

Я ошибочно назвал отображение "продукты" вместо "product_images".

...