Showare 6: 在Twig模板CustomerGroupRegistrationPage中,page.customerGroup返回null。

huangapple go评论64阅读模式
英文:

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) }}

See attached screenshot. Showare 6: 在Twig模板CustomerGroupRegistrationPage中,page.customerGroup返回null。

英文:

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) }}

See attached screenshot. Showare 6: 在Twig模板CustomerGroupRegistrationPage中,page.customerGroup返回null。

答案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) }}

huangapple
  • 本文由 发表于 2023年4月13日 16:15:24
  • 转载请务必保留本文链接:https://go.coder-hub.com/76003163.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定