Instância do operador no Twig / Symfony 2?
Eu tenho uma matriz mista como esta (números e entidades móveis):
$targets = array();
$targets[] = '+32647651212';
$targets[] = new Customer();
No meu modelo Twig eu tenho que ligargetMobile()
E setarget
é umCustomer
ou apenas imprima o número se for realmente um número (string
).
Existe algo comoinstanceof
operador em Twig?
<ul>
{% for target in targets %}
<li>{{ target instance of MyEntity ? target.getMobile : target }}</li>
{% else %}
<li>Nothing found.</li>
</ul>