Hi,
When apply caching PHQL following https://docs.phalcon.io/en/latest/reference/models-cache.html#caching-of-phql-planning, I see the tutorial may be wrong. Because I just a Phalcon newbie, it's take me a lot of time to find out what happening...
In the tutorial:
<?php
$phql = "SELECT * FROM Store\Robots WHERE id = ?0";
$query = $this->modelsManager->createQuery($phql);
for ($i = 1; $i <= 10; $i++) {
$robots = $query->execute($phql, array($i));
// ...
}
But I think it must be:
<?php
$phql = "SELECT * FROM Store\Robots WHERE id = ?0";
$query = $this->modelsManager->createQuery($phql);
for ($i = 1; $i <= 10; $i++) {
$robots = $query->execute(array($i));
// ...
}
Is that right?
Beside of that, in this loop case, if we use the syntax like Robots::find($i)
, can we cache them?