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

How to name a model file when table name is with _

Hi everyone! I'm making a API server with micro.

With tutorial I managed to fetch data from users table. but I don't know how to name a model file for tables that has _ in its name. e.g. users_authorizations

and I don't know how to describe it in PHQL. As tutorial, it would be like Store\Toys\something_aaa but i don't have idea

can anyone help me?? Thank you!



891
Accepted
answer
edited Feb '17

I think you can just CamelCase the classname.

Looking at the code of this forum, https://github.com/phalcon/forum/blob/master/app/model/ActivityNotifications.php

The table in the SQL file for this model is called activity_notifications

Hi, just put the users_authorizations in the name


<?php
//filename - Users_authorizations.php
namespace XXX\YY\Models;

class Users_authorizations extends \Phalcon\Mvc\Model
{

}

Thank you guys Yes I got the problem solved!! You saved me

Just use camelcase to keep things with PSR4.