dimitriBouteille/wp-orm

[BUG]: Undefined getSchemaBuilder() method in Dbout\WpOrm\Orm\Database

mrmoric opened this issue · 4 comments

When I use fill() method of a model, I get the following error:

PHP Fatal error: Uncaught Error: Call to undefined method Dbout\WpOrm\Orm\Database::getSchemaBuilder() in ...

Example code:

$Account->fill($_POST);

Hi @mrmoric

Sorry for this bug, can you share the full trace of the error?

Looking at the ConnectionInterface I see no reference to this function, however this function exists in Connection proof what must be added to Orm\Database :)

[05-Mar-2024 17:28:19 UTC] PHP Fatal error:  Uncaught Error: Call to undefined method Dbout\WpOrm\Orm\Database::getSchemaBuilder() in /var/www/html/wp-content/plugins/gate/vendor/illuminate/database/Eloquent/Concerns/GuardsAttributes.php:221
Stack trace:
#0 /var/www/html/wp-content/plugins/gate/vendor/illuminate/database/Eloquent/Concerns/GuardsAttributes.php(208): Illuminate\Database\Eloquent\Model->isGuardableColumn('form_settings')
#1 /var/www/html/wp-content/plugins/gate/vendor/illuminate/database/Eloquent/Concerns/GuardsAttributes.php(185): Illuminate\Database\Eloquent\Model->isGuarded('form_settings')
#2 /var/www/html/wp-content/plugins/gate/vendor/illuminate/database/Eloquent/Model.php(430): Illuminate\Database\Eloquent\Model->isFillable('form_settings')
#3 /var/www/html/wp-content/plugins/gate/src/Handler/Page/Account/AccountSaveHandler.php(122): Illuminate\Database\Eloquent\Model->fill(Array)
#4 /var/www/html/wp-content/plugins/gate/src/Handler/Page/Account/AccountSaveHandler.php(88): MPFPlugins\Gate\Handler\Page\Account\AccountSaveHandler->handleFormData(Object(MPFPlugins\Gate\Object\PluginSettings), Object(MPFPlugins\Gate\Object\Account))
#5 /var/www/html/wp-includes/class-wp-hook.php(324): MPFPlugins\Gate\Handler\Page\Account\AccountSaveHandler->renderSave('')
#6 /var/www/html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)
#7 /var/www/html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#8 /var/www/html/wp-content/plugins/gate/src/Handler/AdminMenuHandler.php(48): do_action('gate_render_...')
#9 /var/www/html/wp-includes/class-wp-hook.php(324): MPFPlugins\Gate\Handler\AdminMenuHandler->renderSettingsPage('')
#10 /var/www/html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)
#11 /var/www/html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#12 /var/www/html/wp-admin/admin.php(259): do_action('gate_page_ai...')
#13 {main}
  thrown in /var/www/html/wp-content/plugins/gate/vendor/illuminate/database/Eloquent/Concerns/GuardsAttributes.php on line 221

@dimitriBouteille Yes, in our previous conversation I mentioned the they didn't include all needed methods to the interface for some reason.

This bug doesn't happen if explicitly declare $fillable array in Model and put there all fillable fields