We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

RuntimeException: Trying to call method get on a non-object

I have been using Phalcon 1.3.4 and am now starting to develop using Phalcon 2.0. This is the piece of code I am using, compiled from volt into php:

    <?php echo $this->tag->form(array('user/login', 'method' => 'get')); ?>
    <div class="form-group">
      <label>Username</label>
      <?php echo $this->tag->textField(array('username', 'class' => 'form-control')); ?>
    </div>

    <div class="form-group">
      <label>Password</label>
      <?php echo $this->tag->textField(array('password', 'class' => 'form-control')); ?>
    </div>

    <input type="hidden" name="<?php echo $this->security->getTokenKey(); ?>" value="<?php echo $this->security->getToken(); ?>" />

    <?php echo $this->tag->submitButton(array('Login', 'class' => 'btn btn-primary')); ?>
    <?php echo $this->tag->endform(); ?>

The first line in that code is throwing the error. I am using the factory default DI so I have no idea what could be the problem.



10.4k

Problem has been solved and it was a spelling mistake on my part. I was returning $uri in the DI instead of $url.