I have a query that uses multiple INNER JOIN's and relationships between external tables. I tried with the Resultset\Simple, but it depends on a lot of models.
|
May '16 |
4 |
543 |
0 |
PHQL is query language ONLY for models. You can ust just plain PHQL or queryBuilder. But if you need to operate on table names, not model names then you can only use raw sql.
But for your problem you can use just modelsManageR(queryBuilder) i guess.
Why does not work ? What exactly you want achieve ? So you just want to perform sql query etc without models ? Then access db service and make same query. But i would really recommend querybuilder, in most cases it's pretty much enough(until we gonna use unions). Don't know why you want to use mvc framework if you don't gonna have models and want to use raw queries.
Each has their case and their needs. I'm migrating a system that was developed in CodeIgniter for Phalcon. In it there is a module where you work with the ERP tables of the company (legacy system, old but very necessary for the company) to make apportionments between various questions. It is entirely unnecessary to make models for these tables, since they are only for reference. So I need to run some queries (not all) in raw SQL. Can you help me?
Just access db service from di and do whatever you want as raw query - https://docs.phalcon.io/pl/latest/api/Phalcon_Db_Adapter_Pdo_Mysql.html
The raw queries are for this module. The rest of the system is supported by models.
To get an idea of the queries has a INNER JOIN with a view as the main table in addition to making several JOINs with ERP tables by linking them to DBLINKs with specific moorings. Infeasible create models to meet this need since it is only for reference and not insertion and data change.