Need a flow with crude operation

Dear Team,

  • As I am new so can you please give me link for demo code of phalcon for crud operation.


edited Aug '14

Hi naveengujri,

Phalcon works with the MVC pattern, meaning that almost everything you'll do to interact with databases will happen in the "Model". Just setup your connection in index.php, for example:

        // Setup the database component.
        $di->set('db', function() use ($config) {

            // Create connection.
            $connection = new \Phalcon\Db\Adapter\Pdo\Mysql(array(
                "host" => $config->database->host,
                "username" => $config->database->username,
                "password" => $config->database->password,
                "dbname" => $config->database->dbname,
                'persistant' => $config->database->persistant,
                'charset' =>'utf8'

            // Return connection.
            return $connection;


Then create your models, you can read more about them here: You than have access to several CRUD methods, for example ->save(), ->find(), ->findFirst(), ->delete(), etc. on your model.

Hope this helps!