我已经在家庭控制器中配置了属性。 现在,当我尝试使用细枝模板简码显示值时,什么也不显示。有帮助吗?
我已经在家庭控制器中配置了属性:
public function index(PropertiesRepository $repository): Response {
$properties = $repository->findLatest();
// No longer necessary to use this method since we now use the AbstractController
// return new Response($this->twig->render('pages/home.html.twig'));
return $this->render('pages/home.html.twig', [
'properties' => $properties
]);
}
这是我的树枝模板代码,请注意,我已经尝试过原始过滤器,但没有成功:
<div class="row">
{% for property in properties %}
<div class="col-3">
<div class="card">
<div class="card-body">
<h5 class="card-title"><a href="">{{ property.title | raw }}</a></h5>
{{ property.bedrooms | raw }}
<p class="card-text">{{ property.city | raw }} ({{ property.postalCode | raw }})</p>
<div class="text-primary">{{ property.formatedPrice | raw }} €</div>
</div>
</div>
</div>
{% endfor %}
</div>