usually query on model

how to change this "SELECT a., a.name as name_cat, r., r.name as nameal FROM gallerycategory a LEFT JOIN gallery r ON a.default_image = r.id"

to instead use a model?



18.5k

Creating the models => http://docs.phalconphp.com/es/latest/reference/models.html#creating-models Setting the relationships => http://docs.phalconphp.com/es/latest/reference/models.html#relationships-between-models Finding records => http://docs.phalconphp.com/es/latest/reference/models.html#finding-records

When you set the relationships and search a record, the record will have a property with the name of the associated table, so you can access it's properties from the original record.



5.7k

I've tried it but to no avail did not show me the results in Table gallery



18.5k

You don't show the results in the model; you return then from the model to the controller, and there set up for the view.