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

Model - Class must be declared abstract

I all, I'm just introducing to Phalcon but I'm facing with a tricky problem. I've those simple codes (taken from the tutorial https://docs.phalcon.io/en/latest/reference/models.html) but every time I implement the Model it says:

class Robots must be declared abstract or implement methods 'getConnectionService(), setForceExists() etc..'

And the code is just this:

<?php

/**
 * Created by PhpStorm.
 * User: carloventrella
 * Date: 29/08/15
 * Time: 12:11
 */
use Phalcon\Mvc\Model;

class Robots extends  Model{
}
?>

And even if I try to ignore it and to execut an http request it give me

Can't obtain model's source from models list: 'Robots', when preparing: SELECT * FROM robots ORDER BY name

Any ideas?

You created the table robots in your database to after create the model Robots?

edited Aug '15

You created the table robots in your database to after create the model Robots?

Yes, after! It could be an installation problem? I'm using phpStorm

edited Aug '15

your config.php is set up correctly?

return new \Phalcon\Config(array(
    'database' => array(
        'adapter'     => 'Mysql',
        'host'        => 'localhost',
        'username'    => 'root',
        'password'    => '',
        'dbname'      => 'test',
        'charset'     => 'utf8',
    ),

if yes, post your model code

edited Aug '15

Yes it is correct. This is the model code:

<?php

class Robots extends \Phalcon\Mvc\Model
{

    /**
     *
     * @var integer
     */
    public $id;

    /**
     *
     * @var string
     */
    public $name;

    /**
     *
     * @var integer
     */
    public $year;

    /**
     *
     * @var string
     */
    public $type;

    /**
     * Returns table name mapped in the model.
     *
     * @return string
     */
    public function getSource()
    {
        return 'robots';
    }

    /**
     * Allows to query a set of records that match the specified conditions
     *
     * @param mixed $parameters
     * @return Robots[]
     */
    public static function find($parameters = null)
    {
        return parent::find($parameters);
    }

    /**
     * Allows to query the first record that match the specified conditions
     *
     * @param mixed $parameters
     * @return Robots
     */
    public static function findFirst($parameters = null)
    {
        return parent::findFirst($parameters);
    }
    }

It is very strange because this has been genereted by phalcon developer-tools...

UPDATE

If I ignore the error everything works properly..it’s giving me headache