Symfony2 FOSUserBundle显示在树枝模板中过期 [英] Symfony2 FOSUserBundle Display expiresAt in twig template

查看:71
本文介绍了Symfony2 FOSUserBundle显示在树枝模板中过期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的树枝上显示expiresAt,但是出现此错误:

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

注册日期显示得很好.

推荐答案

我在我的User实体

public function getExpiresAt() { 
    return $this->expiresAt; 
} 

因为FOSUserBundle模型用户没有getExpiresAt方法

because FOSUserBundle Model User dosen't has a getExpiresAt method

这篇关于Symfony2 FOSUserBundle显示在树枝模板中过期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆