Operator instancji w Twig / Symfony 2?

Mam tablicę mieszaną taką jak ta (numery telefonów i podmioty):

$targets = array();

$targets[] = '+32647651212';
$targets[] = new Customer();

W moim szablonie Twig muszę zadzwonićgetMobile() Jeślitarget jestCustomer lub po prostu wydrukuj numer, jeśli w rzeczywistości jest to numer (string).

Czy jest coś takiegoinstanceof operator w Twig?

<ul>
{% for target in targets %}
   <li>{{ target instance of MyEntity ? target.getMobile : target }}</li>
   {% else %}
       <li>Nothing found.</li>
</ul>

questionAnswers(7)

yourAnswerToTheQuestion