Symfony variable does not exist in twig
<p>I have these two entities <code>Users.php</code> and <code>sprovider.php</code> and a <code>UserController.php</code>
The thing that bothers me is the result when I try to render a template in this function.</p>

<pre><code> /**
 * @Route("/sproviderhome", name="sprovider_home")
 */
public function sproviderHomeAction(Request $request){

    $email = $request-&gt;get('email');
    $password = $request-&gt;get('password');

    $user= $this-&gt;getDoctrine()
        -&gt;getRepository('AppBundle:Users')-&gt;
        findOneBy(array('email' =&gt; $email, 'password' =&gt; $password));

    $jobs = $this-&gt;getDoctrine()
        -&gt;getRepository('AppBundle:jobs')
        -&gt;findAll();

    if($user){
        return $this-&gt;render('home/sprovider.html.twig', array(
            'user' =&gt; $user,
            'jobs' =&gt; $jobs,
        ));
    }else{
        return $this-&gt;render('home/login.html.twig', array(
            'message' =&gt; "Sorry, you need to login first.",
        ));
    }
}
</code></pre>

<p>Result in <code>sprovider.html.twig</code>:</p>

<blockquote>
  <p>Variable "jobs" does not exist in home/sprovider.html.twig at line 8</p>
</blockquote>

<p><strong>sprovider.html.twig:</strong></p>

<pre><code>{% extends '::base.html.twig' %}

{% block body %}
    {% if user is defined %}
        &lt;h2 class="page-header"&gt;Welcome {{ user.name }}&lt;/h2&gt;
    {% endif %}

    {% for job in jobs %}
        {{ job.name }}
    {% endfor %}
{% endblock %}
</code></pre>

<p>The strange thing here is that <code>$user</code> exists but <code>$jobs</code> does not.</p>

<p>What I tried so far is to dump the <code>jobs</code> and there is no problem, the jobs are in the variable.</p>

<p>Another thing I tried is to pass a string like this:</p>

<pre><code>return $this-&gt;render('home/sprovider.html.twig', array(
            'user' =&gt; $user,
            'jobs' =&gt; 'jobs',
        ));
</code></pre>

<p>Same result. Looks like its rendering only the first object which is strange because I am passing an <code>array()</code>. Am I missing something important? Can this have something to do with <code>cache</code>? I cleared both browser and doctrine cache, still nothing. I can't think of anything else to cause this. In other functions in the same controller I have had no problem rendering an array.</p>