如何解决如何在 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 举报,一经查实,本站将立刻删除。