E
E
ErickSkrauch2015-04-05 22:32:18
PHP
ErickSkrauch, 2015-04-05 22:32:18

How to sample a model with relationships in PhalconPHP?

There is already a fairly large project in PhalconPHP. In general, it suits me a little more than completely, but models have 1 fatal flaw: there is no with () method or anything like that that could select a model along with relationships.
This problem is very acute, because there are some models on the project that almost always use data from relationships when generating a page. You can cache, but a simple LEFT JOIN by index would cost less memory than caching .
The framework itself is now undergoing a census to version 2, which I will gladly switch to, but the point here is somewhat different: now there is no such function.
Hence the question: how can one extend the basic PhalconPHP model to teach it how to query with relationships? If nothing can be done at all, then share Standalone ORM to work with the database.
PS please don't write about the fact that I chose the wrong tool - the tool is good, the only question is with this relationship.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
KorsaR-ZN, 2015-04-05
@ErickSkrauch

You don't read the documentation well...
There are relations there, look here in the documentation.
Relationships in Phalcon are read from the database every time they are accessed, in
order to avoid this behavior, when declaring relations in parameters, specify:

...,
'reusable' => true,
...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question