Phalcon 2 vs Phalcon 3 instantiate model
<p>I've migrated my Phalcon project from 2 to 3 and get some unexpected behavior. In my loader I do this:</p>

<pre><code>&lt;?php
use Phalcon\Loader;

$loader = new Loader();

$loader-&gt;registerDirs(
    array(
        $config-&gt;application-&gt;libraryDir,
        $config-&gt;application-&gt;controllersDir,
        $config-&gt;application-&gt;modelsDir
    )
);

$loader-&gt;register();
</code></pre>

<p>Now, when I try to instantiate one of my models in my controller-action the code halts:</p>

<pre><code>$present = new \Present();
</code></pre>

<p>Results in a "recv() failed (104: Connection reset by peer) while reading response header from upstream" error in /var/log/nginx/error.log.</p>

<p>However, when I instantiate the class directly in my loader.php file the model is auto-loaded and I can instantiate it anywhere. The workaround for the controller action is:</p>

<pre><code>if (class_exists('Present')) { // THIS triggers the autoloader
    $present = new \Present();
    $present-&gt;save();
}
</code></pre>

<p>So the issue is solved for now. My question is: why doesn't </p>

<pre><code>new \Present()
</code></pre>

<p>trigger the auto-loader in the controller-action as I expected? Why did it work under Phalcon 2? Why does it work when I do it directly in the loader.php or in public/index.php?</p>