Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tested with latest 5.5 & 5.6 with Mysql & Sqlite
Please see the following code sample with a demonstration
<?php require 'rb.5.6.php'; \R::setup('sqlite:'.getcwd().'/bindfunc.sqlite'); \R::nuke(); \R::bindFunc( 'read', 'record.point', 'abs' ); \R::bindFunc( 'write', 'record.point', 'abs' ); for($i = 0;$i < 5;$i++){ $record = \R::dispense('record'); $record->point = random_int(-100,-1); \R::store($record); $record->fresh(); // * fresh does not apply bindFunc $record_fetch = \R::load('record',($i+1)); echo 'Fresh ['.$record->point.'] | Load ['.$record_fetch->point.']'.PHP_EOL; } for($i = 0;$i < 3;$i++){ $tag = \R::dispense('tag'); $tag->name = 'TAG_'.$i; \R::store($tag); } $record = \R::load('record',1); $record->sharedTagList[] = \R::load('tag',2); \R::store($record); echo 'Shared Tag Records: got ['.(count($record->sharedTagList)).'], expected [1]' .PHP_EOL; $record = \R::load('record',1); $record->sharedTagList = []; \R::store($record); $record = \R::load('record',1); echo 'Shared Tag Records: got ['.(count($record->sharedTagList)).'], expected [0]' .PHP_EOL; \R::bindFunc( 'read', 'record.point', null ); $record = \R::load('record',1); $record->sharedTagList = []; \R::store($record); $record = \R::load('record',1); echo 'Shared Tag Records: got ['.(count($record->sharedTagList)).'], expected [0]' .PHP_EOL;
The text was updated successfully, but these errors were encountered:
Thanks for the report, we will investigate this issue asap.
Sorry, something went wrong.
Regarding fresh(), it should be used like this:
$bean = $bean->fresh();
See: https://redbeanphp.com/index.php?p=/crud
This bug has been confirmed.
8347286
This has been fixed in the master branch. I used your example as a unit test.
No branches or pull requests
Tested with latest 5.5 & 5.6 with Mysql & Sqlite
$bean->fresh does not apply bindFunc()Please see the following code sample with a demonstration
The text was updated successfully, but these errors were encountered: