You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TL:DR - This one in on me, I did promisse to add to phalcon and I will, but it is not a simple problem I do have a working proptotype in PHP on a project for the past 10 months and tinkering, now we all know what happen since then.
First Level Cache is caching the models that you request from the database instead of fetching a new one everytime.
For example:
$owner->id = 1;
$owner->name = 'Test';
$owner->robots = [$robot];
$owner->save();
So far so good but
$robot->owner->name = 'Phalcon';
echo $owner->name; # output will be Test instead of Phalcon
it will fetch the model again to the database keeping a single source of truth
Also add to hasMany some ArrayObject fuctionality and others
I got working somewhat the append, remove and delete
For example
I would like to add also a iterator, it would help to remove or delete model relations while iterating with a for or a while.
The iterator is important because if we remove one object from a current array the total shrinks to -1, meaning that you will skip one model in the relation.
TL:DR - This one in on me, I did promisse to add to phalcon and I will, but it is not a simple problem I do have a working proptotype in PHP on a project for the past 10 months and tinkering, now we all know what happen since then.
First Level Cache is caching the models that you request from the database instead of fetching a new one everytime.
For example:
$owner->id = 1;
$owner->name = 'Test';
$owner->robots = [$robot];
$owner->save();
So far so good but
$robot->owner->name = 'Phalcon';
echo $owner->name; # output will be Test instead of Phalcon
it will fetch the model again to the database keeping a single source of truth
Also add to hasMany some ArrayObject fuctionality and others
I got working somewhat the append, remove and delete
For example
$owner->robots->append($robot);
$owner->robots->remove($robot)
$owner->robots->delete($robot)
I would like to add also a iterator, it would help to remove or delete model relations while iterating with a for or a while.
The iterator is important because if we remove one object from a current array the total shrinks to -1, meaning that you will skip one model in the relation.
Hopefuly "The WeakReference class" can be used for this, it provides better memory management since hopefully it wont prevent GC from doing it's thing.
https://www.php.net/manual/en/class.weakreference.php
@niden has soon has we have coverage of MVC I will get to work.
The text was updated successfully, but these errors were encountered: