<p dir="auto">The recent changes @bschussek made in the FormView class in <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/symfony/symfony/commit/d072f35ea0166004b6407d510ec9f484f8eef78a/hovercard" href="https://github.com/symfony/symfony/commit/d072f35ea0166004b6407d510ec9f484f8eef78a"><tt>d072f35</tt></a> make it impossible to access the <code class="notranslate">vars</code> property in Twig without using the deprecated method <code class="notranslate">get()</code>.</p>
<p dir="auto">Now the FormView class implements the <code class="notranslate">ArrayAccess</code> interface, so by defaut, in Twig, when using <code class="notranslate">form.vars.full_name</code> it goes first to search within the array, and the array contains the form children, not the <code class="notranslate">vars</code>property. So now, we are forced to go through the deprecated method <code class="notranslate">form.get('full_name')</code> with no other option to access the public property.</p>
<p dir="auto">Is this the expected behaviour? It's a Twig issue maybe?</p>
<p dir="auto">The twig syntax <code class="notranslate">form.field.vars</code> is broken since beta3. I have a simple form:</p>
<div class="highlight highlight-text-html-php notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="namespace Acme\DemoBundle\Model;

class Test
{
    private $url;

    public function getUrl()
    {
        return $this-&gt;url;
    }
}"><pre class="notranslate"><span class="pl-k">namespace</span> <span class="pl-v">Acme</span>\<span class="pl-v">DemoBundle</span>\<span class="pl-v">Model</span>;

<span class="pl-k">class</span> <span class="pl-v">Test</span>
{
    <span class="pl-k">private</span> <span class="pl-c1"><span class="pl-c1">$</span>url</span>;

    <span class="pl-k">public</span> <span class="pl-k">function</span> <span class="pl-en">getUrl</span>()
    {
        <span class="pl-k">return</span> <span class="pl-s1"><span class="pl-c1">$</span><span class="pl-smi">this</span></span>-&gt;<span class="pl-c1">url</span>;
    }
}</pre></div>
<div class="highlight highlight-text-html-php notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="namespace Acme\DemoBundle\Form;

class TestType extends AbstractType
{
    // etc
}"><pre class="notranslate"><span class="pl-k">namespace</span> <span class="pl-v">Acme</span>\<span class="pl-v">DemoBundle</span>\<span class="pl-v">Form</span>;

<span class="pl-k">class</span> <span class="pl-v">TestType</span> <span class="pl-k">extends</span> <span class="pl-v">AbstractType</span>
{
    <span class="pl-c">// etc</span>
}</pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="{% if form.url.vars.errors | length == 0 %}
{% endif %}"><pre class="notranslate"><code class="notranslate">{% if form.url.vars.errors | length == 0 %}
{% endif %}
</code></pre></div>
<p dir="auto">The above syntax generates the following error:</p>
<blockquote>
<p dir="auto">Notice: Undefined index: vars in symfony/src/Symfony/Component/Form/FormView.php line 308</p>
</blockquote>
<p dir="auto">I did some digging and it seems that <code class="notranslate">FormView</code> implements <code class="notranslate">ArrayAccess</code> which calls <code class="notranslate">offsetGet</code>, and that method returns <code class="notranslate">$this-&gt;children[$name]</code>. Is there another way to call <code class="notranslate">FormView-&gt;vars</code> in twig or is this a bug? I could of cource use <code class="notranslate">form.url.get('errors')</code> but that method is deprecated. The readme suggest using the public property <code class="notranslate">vars</code> but it's not possible to call it in a twig template?</p>