树枝中不显示属性

时间:2014-02-03 20:18:34

标签: symfony twig

我有一个没有用树枝显示的属性 immobilier.ref 这是代码

                                    {% for immobilier in listImmobilier %}

                                    <tr>
                                        <td>{{ immobilier.id }}</td>
                                        <td>{{ immobilier.ref }}</td>
                                        <td>{{ immobilier.titre }}</td>
                                        <td><a href="{{ path('immobilier_show', { 'id': immobilier.id }) }}"><span class="glyphicon glyphicon-eye-open" style="display:block; text-align:center"></span></a></td> 
                                        <td><a href="{{ path('immobilier_edit', { 'id': immobilier.id }) }}">Edit</a></td>
                                        <td><a href="{{ path('immobilier_delete', { 'id': immobilier.id }) }}">Delete</a></td>
                                    </tr>

                                {% endfor %}

这是桌子的照片 enter image description here

1 个答案:

答案 0 :(得分:0)

它(现在很好,这是因为我在实体中有一个名为ref的函数

    /**
 * @ORM\PostPersist()
 */
public function ref()
{
    $id = $this->getId();
    $operation = $this->getOperation()->getRef();
    $this->setRef($id.$operation);
}

我改名了,现在工作正常。