Modifying existing array record does nothing.
Opened this issue · 2 comments
Steps to reproduce:
$db = new \DB\Cortex( new \DB\Jig( __DIR__ ), 'db.json' );
$db->myArray = array( 'a' => 1, 'b' => 2 );
$db->myArray['a'] = 3;
#Result:
$db->myArray['a'] === 1;
#Expected:
$db->myArray['a'] === 3;
#Ugly patch
$db->myArray = array_merge( $db->myArray, array( 'a' => 3 ) );
I could probably fix that, but it would conflict with the feature of custom getter / setter functions and events. If i pass it by reference (and that's the point here in your example), every access to the variable would change the raw data at its origin, and as a result of this skip silently those events, making that feature inconsistent 🤔
So I'm not exactly sure how to deal with it right now.
Take your time 👍 It was hard to spot the issue when I refactored from Jig to Cortex as most of my code was using arrays and since it was working before, seemed logical to work with Cortex too, until tested..