Using @noobiwan answer...
I had to implement this kind of model, related from another query without a specific table.
Solution:
Create a table without extending \Phalcon\Mvc\Model
After the raw query
$connection = DI::getDefault()->get('db');
$result_set = $connection->query($query);
$result_set->setFetchMode(Db::FETCH_ASSOC);
$result_set = $result_set->fetchAll($result_set);
Do a foreach on resultset then anither foreach for the propeties, assigning inside yout new model with PUBLIC properties.
$collection = [];
foreach ($inventoryItems as $item) {
$model = new Model();
foreach ($item as $k => $v) {
$model->$k = $v;
}
$collection[] = $model;
That's the best sollution i could find, but you loose Resultset
benefits.