微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何在 hautelook 固定装置中将 current() 传递给模板

如何解决如何在 hautelook 固定装置中将 current() 传递给模板

我使用的是 Symfony 3.4 和这个包 https://github.com/hautelook/AliceBundle

这是我的 YAML 文件

AppBundle\Entity\Product:
  template_product (template):
    unit:              !PHP/const AppBundle\Entity\ItemInterface::UNIT_PCS

  product_teeth_{1} (extends template_product):
    name:              Răng sứ kim loại Mỹ ( BH 3 năm )
    price:             1500000
    categoryProducts : ["@category_product_<current()>_1","@category_product_<current()>_2"]
    storeItems:        ["@store_product_<current()>_1","@store_product_<current()>_2"]

  product_teeth_{2} (extends template_product):
    name:              Răng sứ Vita Đức ( BH 4 năm )
    price:             1800000
    categoryProducts : ["@category_product_<current()>_1","@store_product_<current()>_2"]

  product_teeth_{3} (extends template_product):
    name:              Răng toàn sứ Zirconia ( CAD/CAM ) ( BH 7 năm )
    price:             3900000
    categoryProducts : ["@category_product_<current()>_1","@store_product_<current()>_2"]

  product_teeth_{4} (extends template_product):
    name:              Răng sứ Titan ( BH 5 năm )
    price:             2400000
    categoryProducts : ["@category_product_<current()>_1","@store_product_<current()>_2"]

  product_teeth_{5} (extends template_product):
    name:              Răng toàn sứ Full Zirconia ( CAD/CAM ) ( BH 10 năm )
    price:             4400000
    categoryProducts : ["@category_product_<current()>_1","@store_product_<current()>_2"]

  product_teeth_{6} (extends template_product):
    name:              Răng toàn sứ Lava Plus - Ceramay (BH 20 năm)
    price:             1200000
    categoryProducts : ["@category_product_<current()>_1","@store_product_<current()>_2"]

AppBundle\Entity\CategoryProduct:
  template_category_product (template):
    id:       <(substr(md5(uniqid(rand(),true)),18))>

  template_category_1 (template,extends template_category_product):
    category: "@category_product"
  template_category_2 (template,extends template_category_product):
    category: "@category_product_1"

  category_product_{1..3}_1 (extends template_category_1):
    item:     "@product_teeth_<current()>"
  category_product_{1..3}_2 (extends template_category_2):
    item:     "@product_teeth_<current()>"

AppBundle\Entity\StoreProduct:
  template_store_product (template):
    id:       <(substr(md5(uniqid(rand(),18))>

  template_store_1 (template,extends template_store_product):
    store:    "@store_dentist_1"
  template_store_2 (template,extends template_store_product):
    store:    "@store_dentist_2"

  store_product_{1..3}_1 (extends template_store_1):
    item:     "@product_teeth_<current()>"
  store_product_{1..3}_2 (extends template_store_2):
    item:     "@product_teeth_<current()>"

问题是,正如您看到的这些行。他们重复多次:

    categoryProducts : ["@category_product_<current()>_1","@store_product_<current()>_2"]

我不知道如何将 <current()> 传递给模板以减少行数。

谁能告诉我怎么做?

有什么办法可以解决我的问题吗?

我没有被卡住,但是在使用设备库时尝试在 YAML 中做最佳实践 DRY

解决方法

我尝试了一些解决方案后得到了答案。

composer 应该放在最后

例如类别应该是这样的:

--ignore-platform-reqs

和产品

current()

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?