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

Few questions after read the phalcon codes

Is there a way to make a 'Query Builder' without a model especialy to SELECT statement? Is there a default route parameter for Micro Application?

$app->get('/helo/{name}', function($name = 'You') { echo $name; }); the route for only /helo should echoing 'You'

No, I think you have to have a Model to be able to interact with a database no matter what.

As for you second question, about setting a default route, yes. Routing : Default Route. I checked and it's the same within a micro-app.



16.3k
edited Apr '14

No, I think you have to have a Model to be able to interact with a database no matter what.

Okay so i have to build my own Query Builder.

Oow, the doc about default route is not clear enough for me, look like i have to create one Phalcon\Mvc\Router instance for every default route.

thanks @unisys12

edited Apr '14

I think you misunderstood. You do not have to build your own Query Builder. Phalcon has a built in a ORM that can be used for simple queries like findBy, findFirst for example. Phalcon also has a built-in Query Builder, called PHQL, which you can use to build more complex queries. But for the queries to work you have to set up a model.



16.3k
edited Jun '14

I have read PHQL, Model Manager, and also use few find static method, but i currently on a project that had many tables. about hundred tables. ya, i can just use bash to generate it but is not beautiful enough when i see lot of files in a folder

for i in `mysql -u user -p -e "show tables from mydb" | grep -V Tables`
do
phalcon model --name=$i
done

EDITED:

phalcon all-models