duankan6894 2018-05-25 11:43
浏览 40
已采纳

Sylius定制模型与图像

I followed those recipes to:

  1. Create a custom model
  2. Add images to this custom model

I detected some things that don't happens like the recipes say, but once I have my custom model working, with the forms, the grid, the validation, the form extended to allow upload images... I got this error after send the form of creating a new object:

An exception occurred while executing 'INSERT INTO app_designer_image (type, path, owner_id) VALUES (?, ?, ?)' with params ["avatar", null, 2]:

I can't find the way to upload an image. Following the recipe, I defined a Image Upload Service listener, listening to the sylius.designer.pre_create and sylius.designer.pre_update but those events are never triggered, and when the image is going to be persisted, always fail because the path is not defined...

Any clue of what can be happening?

  • 写回答

1条回答 默认 最新

  • dsw1608 2018-05-29 13:39
    关注

    OK, I found the problem. There was a misconfiguration for the event listener, I attach the listener to the wrong event.

    My mistake was follow strictly all the steps in this recipe. The problem is that the recipe is based on an extended version of an existing model, and the name of the events for a custom model is prepended by app. instead of sylius..

    So, the event in the example is sylius.shipping_method.pre_create and mine is not sylius.designer.pre_create but app.designer.pre_create.

    Once I fixed this everything starts to work as expected.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥30 python代码,帮调试,帮帮忙吧