问题描述
我想在树枝上显示Expiresat,但我有一个错误:
Method "expiresat" for object "AuthenticationBundle\Entity\User" does not exist in AdminNCBundle:NC:list_clients.html.twig at line 43
在我的树枝中,我做了一个:
{% for client in clients %} <tr> <td>{{ client.firstname }} {{ client.lastname }}</td> <td>{{ client.telephone }}</td> <td>{{ client.registrationdate|date('Y-m-d H:i:s') }}</td> <td>{{ client.expiresat|date('Y-m-d H:i:s') }}</td> <td>{{ client.duration }}</td> </tr> {% endfor %}
注册日期非常好.
推荐答案
我在我的User实体中添加了一种方法
public function getExpiresAt() { return $this->expiresAt; }
因为fosuserbundle模型用户没有getExpiresAt方法
问题描述
I want to display the expiresAt in my twig but i have this error :
Method "expiresat" for object "AuthenticationBundle\Entity\User" does not exist in AdminNCBundle:NC:list_clients.html.twig at line 43
in my twig i have done a for :
{% for client in clients %} <tr> <td>{{ client.firstname }} {{ client.lastname }}</td> <td>{{ client.telephone }}</td> <td>{{ client.registrationdate|date('Y-m-d H:i:s') }}</td> <td>{{ client.expiresat|date('Y-m-d H:i:s') }}</td> <td>{{ client.duration }}</td> </tr> {% endfor %}
the registrationdate displayed very well.
推荐答案
the answer of geoB is correct
i added a method in my User entity
public function getExpiresAt() { return $this->expiresAt; }
because FOSUserBundle Model User dosen't has a getExpiresAt method
相关问答
twig模板中的ckeditor + symfony2
在symfony2中的my Twig模板中显示JSON数据
Symfony2 FOSUserBundle FOSUserEvents
Symfony2、twig和JavaScript
Symfony2 & Twig : 显示所有字段和键值
用FOSUserBundle扩展Symfony2的UserManager
覆盖FOSUserBundle路由Symfony2
Symfony2 FOSUserBundle和组的错误
Symfony2 FOSUserBundle角色实体
Symfony2 FOSUserBundle错误-FileLoaderImportCircularReferenceException