Symfony2 FOSUserBundle Display expiresAt in twig t

2019-08-01 04:12发布

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.

1条回答
Deceive 欺骗
2楼-- · 2019-08-01 05:07

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

查看更多
登录 后发表回答