英文:
Showare 6: page.customerGroup returns null in twig template CustomerGroupRegistrationPage
问题
We have a problem, accessing the customer group in the customer group registration page. Dumping the page object, the customerGroup is displayed:
{{ dump(page) }}
Dumping the customerGroup returns null:
{{ dump(page.customerGroup) }}
英文:
We have a problem, accessing the customer group in the customer group registration page. Dumping the page object, the customerGroup is displayed:
{{ dump(page) }}
Dumping the customerGroup returns null:
{{ dump(page.customerGroup) }}
答案1
得分: 0
这是由于在CustomerGroupRegistrationPage
中,通常的获取器命名约定发生了偏差所导致的。通常,属性将解析为getCustomerGroup
的调用,但在这种情况下,获取器命名为getGroup
。然而,您可以直接调用该获取器。
{{ dump(page.getGroup()) }}
或者,这也应该起作用:
{{ dump(page.group) }}
英文:
This is caused by a deviation of the usual naming conventions for getters in CustomerGroupRegistrationPage
. Usually the property would resolve to a call of getCustomerGroup
but in this case the getter is named getGroup
. However you can just call the getter directly.
{{ dump(page.getGroup()) }}
Alternatively this should work as well:
{{ dump(page.group) }}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论