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

Business Logic in Phalcon PHP Models

Traditionally in MVC, all Business logic - Calculations using table data, manipulating data etc - are done in models. But in the case of Phalcon PHP, models are jst calss files for ORM. Is it possible to processing POST data and inserting it into DB are write inside of a Model ?

I am new to Phalcon PHP and I have some experiance with CodeIgniter.

edited Mar '14

You shouldn't use global namespaces inside model.
If you need to initialize model by $_POST, you should do it in controller by assign method

class UsersController extends \Phalcon\Mvc\Controller
{
    public function saveAction()
    {
        $new_user = new Users();
        $new_user->assign($_POST);
        $new_user->save();
    }
}

But proper way is here
https://docs.phalcon.io/en/latest/reference/tutorial.html#storing-data-using-models