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
{{ message }}
Repository navigation
Extend not possible due to private helper methods #44
Hello, please consider to make the private helper methods protected. It is not possible to extend SleekDb this way. After setting bootStore and initVariables from private to protected i was able to extend, but also had to copy the whole store method:
class LibreSleekDb extends \SleekDB\SleekDB
{
publicstaticfunctionstore( $storeName = false, $dataDir, $options = false ) {
if ( !$storeNameORempty( $storeName ) ) thrownew \Exception( 'Store name was not valid' );
$_dbInstance = newLibreSleekDb( $dataDir, $options );
$_dbInstance->storeName = $storeName;
// Boot store.$_dbInstance->bootStore();
// Initialize variables for the store.$_dbInstance->initVariables();
return$_dbInstance;
}
publicfunctionfetch()
{
$results = parent::fetch();
foreach ($resultsas$key => $result) {
$results[$key] = (object) $result;
}
return$results;
}
}
Now i can do LibreSleekDb::store('articles', $dataDir);
Activity
rakibtg commentedon Oct 21, 2020
Can you tell me a little more about this use case, why you wanted to extend it instead of initialising it directly inside the
LibreSleekDbclass?rakibtg commentedon Oct 21, 2020
@einicher Thanks for the details, I will look into it. If you have any further input on this in the mean time let me know.
Timu57 commentedon Jan 24, 2021
We refactored and rewrote the whole project. Possible that it now suites your needs. I will close this issue. Feel free to reopen it if needed.