1. <small id='TRR5h'></small><noframes id='TRR5h'>

      <i id='TRR5h'><tr id='TRR5h'><dt id='TRR5h'><q id='TRR5h'><span id='TRR5h'><b id='TRR5h'><form id='TRR5h'><ins id='TRR5h'></ins><ul id='TRR5h'></ul><sub id='TRR5h'></sub></form><legend id='TRR5h'></legend><bdo id='TRR5h'><pre id='TRR5h'><center id='TRR5h'></center></pre></bdo></b><th id='TRR5h'></th></span></q></dt></tr></i><div id='TRR5h'><tfoot id='TRR5h'></tfoot><dl id='TRR5h'><fieldset id='TRR5h'></fieldset></dl></div>
    1. <legend id='TRR5h'><style id='TRR5h'><dir id='TRR5h'><q id='TRR5h'></q></dir></style></legend>
        <bdo id='TRR5h'></bdo><ul id='TRR5h'></ul>
    2. <tfoot id='TRR5h'></tfoot>

    3. 如何在 yml 映射的实体中配置 VichUploader?

      How to configure VichUploader in entity mapped by yml?(如何在 yml 映射的实体中配置 VichUploader?)
    4. <i id='2itBV'><tr id='2itBV'><dt id='2itBV'><q id='2itBV'><span id='2itBV'><b id='2itBV'><form id='2itBV'><ins id='2itBV'></ins><ul id='2itBV'></ul><sub id='2itBV'></sub></form><legend id='2itBV'></legend><bdo id='2itBV'><pre id='2itBV'><center id='2itBV'></center></pre></bdo></b><th id='2itBV'></th></span></q></dt></tr></i><div id='2itBV'><tfoot id='2itBV'></tfoot><dl id='2itBV'><fieldset id='2itBV'></fieldset></dl></div>

        <small id='2itBV'></small><noframes id='2itBV'>

        • <bdo id='2itBV'></bdo><ul id='2itBV'></ul>

          <tfoot id='2itBV'></tfoot><legend id='2itBV'><style id='2itBV'><dir id='2itBV'><q id='2itBV'></q></dir></style></legend>

                  <tbody id='2itBV'></tbody>

                本文介绍了如何在 yml 映射的实体中配置 VichUploader?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我有一个名为杂志"的实体,从 yml 文件映射:

                I have a entity called 'Magazine', mapped from yml file:

                AcmeDemoBundleEntityMagazine:
                  type: entity
                  table: magazine
                  id:
                    id:
                      type: integer
                      generator: { strategy: AUTO }
                
                  fields:
                    edition:
                        type: string
                        length: 255
                        nullable: false
                    title:
                        type: text
                        nullable: false
                    cover:
                        type: string
                        length: 255
                        nullable: false
                    file:
                        mapping: magazine_cover
                        filename_property: cover
                

                我在 app/config/config.yml 中做了必要的配置:

                I made the configuration necessary in the app/config/config.yml:

                knp_gaufrette:
                  stream_wrapper: ~
                
                vich_uploader:
                  db_driver: orm
                  mappings:
                    magazine_cover:
                      uri_prefix:         /upload/magazine/cover
                      upload_destination: %kernel.root_dir%/../web/upload/magazine/cover
                      delete_on_remove:   true
                

                实体文件:

                use DoctrineORMMapping as ORM;
                
                use SymfonyComponentHttpFoundationFileFile;
                use SymfonyComponentValidatorConstraints as Assert;
                use VichUploaderBundleMappingPropertyMapping as Vich;
                

                我没有以这种方式工作,在杂志"表中创建了一个字段文件",这不应该发生.我发现一些文章解释了如何使用注释进行配置,但 yml 我什么也没找到.

                I'm not getting work this way, a field 'file' is created in the 'magazine' table, which doesnt should happens. I've found some articles explaining how configure using annotation but yml I don't found nothing.

                推荐答案

                如果您阅读 文档仔细,你会注意到上传相关的配置并没有与学说的实体声明混合.

                If you read the documentation carefully, you'll notice that the upload-related configuration isn't mixed with doctrine's entity declaration.

                您需要创建一个 src/Acme/DemoBundle/Resource/config/vich_uploader/Magazine.yml 文件,内容如下:

                You need to create a src/Acme/DemoBundle/Resource/config/vich_uploader/Magazine.yml file with the following content:

                AcmeDemoBundleEntityMagazine:
                    file:
                        mapping: magazine_cover
                        filename_property: cover
                

                您将在我的 沙盒应用程序中找到工作代码示例.

                这篇关于如何在 yml 映射的实体中配置 VichUploader?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                  • <bdo id='w6JH2'></bdo><ul id='w6JH2'></ul>

                      <tbody id='w6JH2'></tbody>

                  • <legend id='w6JH2'><style id='w6JH2'><dir id='w6JH2'><q id='w6JH2'></q></dir></style></legend>
                  • <small id='w6JH2'></small><noframes id='w6JH2'>

                    <tfoot id='w6JH2'></tfoot>

                      1. <i id='w6JH2'><tr id='w6JH2'><dt id='w6JH2'><q id='w6JH2'><span id='w6JH2'><b id='w6JH2'><form id='w6JH2'><ins id='w6JH2'></ins><ul id='w6JH2'></ul><sub id='w6JH2'></sub></form><legend id='w6JH2'></legend><bdo id='w6JH2'><pre id='w6JH2'><center id='w6JH2'></center></pre></bdo></b><th id='w6JH2'></th></span></q></dt></tr></i><div id='w6JH2'><tfoot id='w6JH2'></tfoot><dl id='w6JH2'><fieldset id='w6JH2'></fieldset></dl></div>