bitmatrixstudio / craft-omnisearch

A powerful control panel search filter replacement for CraftCMS
Other
5 stars 0 forks source link

Does not work with Super Table #18

Closed devinpitcher closed 2 years ago

devinpitcher commented 2 years ago

I have been unable to use this plugin as whenever it's enabled, I get the following error when trying to access any part of the admin CP:

Error: Call to a member function getService() on null in /app/craftcms/vendor/verbb/super-table/src/fields/SuperTableField.php:229

Disabling Omnisearch stops the error from happening.

Plugin version: 1.2.3 PHP version: 8.0.10 Craft edition & version: Craft Pro 3.7.23 Super Table version: 2.6.8

Error: Call to a member function getService() on null in /app/craftcms/vendor/verbb/super-table/src/fields/SuperTableField.php:229
Stack trace:
#0 /app/craftcms/vendor/verbb/super-table/src/fields/SuperTableField.php(243): verbb\supertable\fields\SuperTableField->getBlockTypes()
#1 /app/craftcms/vendor/bitmatrix/craft-omnisearch/src/behaviors/OmniSearchFilterBehavior.php(98): verbb\supertable\fields\SuperTableField->getBlockTypeFields()
#2 /app/craftcms/vendor/bitmatrix/craft-omnisearch/src/behaviors/OmniSearchFilterBehavior.php(55): bitmatrix\omnisearch\behaviors\OmniSearchFilterBehavior->mapCustomFields(Array)
#3 [internal function]: bitmatrix\omnisearch\behaviors\OmniSearchFilterBehavior->beforePrepare(Object(craft\events\CancelableEvent))
#4 /app/craftcms/vendor/yiisoft/yii2/base/Component.php(628): call_user_func(Array, Object(craft\events\CancelableEvent))
#5 /app/craftcms/vendor/craftcms/cms/src/elements/db/ElementQuery.php(2078): yii\base\Component->trigger('beforePrepare', Object(craft\events\CancelableEvent))
#6 /app/craftcms/vendor/craftcms/cms/src/elements/db/UserQuery.php(721): craft\elements\db\ElementQuery->beforePrepare()
#7 /app/craftcms/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1445): craft\elements\db\UserQuery->beforePrepare()
#8 /app/craftcms/vendor/yiisoft/yii2/db/QueryBuilder.php(227): craft\elements\db\ElementQuery->prepare(Object(craft\db\pgsql\QueryBuilder))
#9 /app/craftcms/vendor/yiisoft/yii2/db/Query.php(157): yii\db\QueryBuilder->build(Object(craft\elements\db\UserQuery))
#10 /app/craftcms/vendor/yiisoft/yii2/db/Query.php(287): yii\db\Query->createCommand(Object(craft\db\Connection))
#11 /app/craftcms/vendor/craftcms/cms/src/db/Query.php(167): yii\db\Query->one(NULL)
#12 /app/craftcms/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1634): craft\db\Query->one(NULL)
#13 /app/craftcms/vendor/craftcms/cms/src/elements/User.php(452): craft\elements\db\ElementQuery->one()
#14 /app/craftcms/vendor/yiisoft/yii2/web/User.php(700): craft\elements\User::findIdentity(1)
#15 /app/craftcms/vendor/craftcms/cms/src/web/User.php(522): yii\web\User->renewAuthStatus()
#16 /app/craftcms/vendor/yiisoft/yii2/web/User.php(199): craft\web\User->renewAuthStatus()
#17 /app/craftcms/vendor/craftcms/cms/src/web/User.php(272): yii\web\User->getIdentity()
#18 /app/craftcms/vendor/venveo/craft-bulkedit/src/Plugin.php(81): craft\web\User->checkPermission('PERMISSION_BULK...')
#19 /app/craftcms/vendor/yiisoft/yii2/base/BaseObject.php(109): venveo\bulkedit\Plugin->init()
#20 /app/craftcms/vendor/yiisoft/yii2/base/Module.php(158): yii\base\BaseObject->__construct(Array)
#21 /app/craftcms/vendor/craftcms/cms/src/base/Plugin.php(115): yii\base\Module->__construct('venveo-bulk-edi...', Object(craft\web\Application), Array)
#22 [internal function]: craft\base\Plugin->__construct('venveo-bulk-edi...', Object(craft\web\Application), Array)
#23 /app/craftcms/vendor/yiisoft/yii2/di/Container.php(420): ReflectionClass->newInstanceArgs(Array)
#24 /app/craftcms/vendor/yiisoft/yii2/di/Container.php(171): yii\di\Container->build('venveo\\bulkedit...', Array, Array)
#25 /app/craftcms/vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get('venveo\\bulkedit...', Array, Array)
#26 /app/craftcms/vendor/craftcms/cms/src/Craft.php(67): yii\BaseYii::createObject(Array, Array)
#27 /app/craftcms/vendor/craftcms/cms/src/services/Plugins.php(981): Craft::createObject(Array, Array)
#28 /app/craftcms/vendor/craftcms/cms/src/services/Plugins.php(233): craft\services\Plugins->createPlugin('venveo-bulk-edi...', Array)
#29 /app/craftcms/vendor/craftcms/cms/src/services/Plugins.php(301): craft\services\Plugins->loadPlugins()
#30 /app/craftcms/vendor/superbig/craft3-bugsnag/src/Bootstrap.php(19): craft\services\Plugins->getPlugin('bugsnag')
#31 /app/craftcms/vendor/yiisoft/yii2/base/Application.php(333): superbig\bugsnag\Bootstrap->bootstrap(Object(craft\web\Application))
#32 /app/craftcms/vendor/craftcms/cms/src/web/Application.php(110): yii\base\Application->bootstrap()
#33 /app/craftcms/vendor/yiisoft/yii2/base/Application.php(279): craft\web\Application->bootstrap()
#34 /app/craftcms/vendor/craftcms/cms/src/web/Application.php(91): yii\base\Application->init()
#35 /app/craftcms/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\web\Application->init()
#36 /app/craftcms/vendor/yiisoft/yii2/base/Application.php(212): yii\base\BaseObject->__construct(Array)
#37 [internal function]: yii\base\Application->__construct(Array)
#38 /app/craftcms/vendor/yiisoft/yii2/di/Container.php(420): ReflectionClass->newInstanceArgs(Array)
#39 /app/craftcms/vendor/yiisoft/yii2/di/Container.php(171): yii\di\Container->build('craft\\web\\Appli...', Array, Array)
#40 /app/craftcms/vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get('craft\\web\\Appli...', Array, Array)
#41 /app/craftcms/vendor/craftcms/cms/src/Craft.php(67): yii\BaseYii::createObject(Array, Array)
#42 /app/craftcms/vendor/craftcms/cms/bootstrap/bootstrap.php(242): Craft::createObject(Array)
#43 /app/craftcms/vendor/craftcms/cms/bootstrap/web.php(51): require('/app/craftcms/v...')
#44 /app/craftcms/web/index.php(23): require('/app/craftcms/v...')
#45 {main}
bitmatrixstudio commented 2 years ago

Hi Devin,

Okay, we’ll look into it.

Best Regards, Poh Nean

On 30 Nov 2021, at 7:11 AM, Devin Pitcher @.***> wrote:

 I have been unable to use this plugin as whenever it's enabled, I get the following error when trying to access any part of the admin CP:

Error: Call to a member function getService() on null in /app/craftcms/vendor/verbb/super-table/src/fields/SuperTableField.php:229

Disabling Omnisearch stops the error from happening.

Plugin version: 1.2.3 PHP version: 8.0.10 Craft edition & version: Craft Pro 3.7.23 Super Table version: 2.6.8

Error: Call to a member function getService() on null in /app/craftcms/vendor/verbb/super-table/src/fields/SuperTableField.php:229 Stack trace:

0 /app/craftcms/vendor/verbb/super-table/src/fields/SuperTableField.php(243): verbb\supertable\fields\SuperTableField->getBlockTypes()

1 /app/craftcms/vendor/bitmatrix/craft-omnisearch/src/behaviors/OmniSearchFilterBehavior.php(98): verbb\supertable\fields\SuperTableField->getBlockTypeFields()

2 /app/craftcms/vendor/bitmatrix/craft-omnisearch/src/behaviors/OmniSearchFilterBehavior.php(55): bitmatrix\omnisearch\behaviors\OmniSearchFilterBehavior->mapCustomFields(Array)

3 [internal function]: bitmatrix\omnisearch\behaviors\OmniSearchFilterBehavior->beforePrepare(Object(craft\events\CancelableEvent))

4 /app/craftcms/vendor/yiisoft/yii2/base/Component.php(628): call_user_func(Array, Object(craft\events\CancelableEvent))

5 /app/craftcms/vendor/craftcms/cms/src/elements/db/ElementQuery.php(2078): yii\base\Component->trigger('beforePrepare', Object(craft\events\CancelableEvent))

6 /app/craftcms/vendor/craftcms/cms/src/elements/db/UserQuery.php(721): craft\elements\db\ElementQuery->beforePrepare()

7 /app/craftcms/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1445): craft\elements\db\UserQuery->beforePrepare()

8 /app/craftcms/vendor/yiisoft/yii2/db/QueryBuilder.php(227): craft\elements\db\ElementQuery->prepare(Object(craft\db\pgsql\QueryBuilder))

9 /app/craftcms/vendor/yiisoft/yii2/db/Query.php(157): yii\db\QueryBuilder->build(Object(craft\elements\db\UserQuery))

10 /app/craftcms/vendor/yiisoft/yii2/db/Query.php(287): yii\db\Query->createCommand(Object(craft\db\Connection))

11 /app/craftcms/vendor/craftcms/cms/src/db/Query.php(167): yii\db\Query->one(NULL)

12 /app/craftcms/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1634): craft\db\Query->one(NULL)

13 /app/craftcms/vendor/craftcms/cms/src/elements/User.php(452): craft\elements\db\ElementQuery->one()

14 /app/craftcms/vendor/yiisoft/yii2/web/User.php(700): craft\elements\User::findIdentity(1)

15 /app/craftcms/vendor/craftcms/cms/src/web/User.php(522): yii\web\User->renewAuthStatus()

16 /app/craftcms/vendor/yiisoft/yii2/web/User.php(199): craft\web\User->renewAuthStatus()

17 /app/craftcms/vendor/craftcms/cms/src/web/User.php(272): yii\web\User->getIdentity()

18 /app/craftcms/vendor/venveo/craft-bulkedit/src/Plugin.php(81): craft\web\User->checkPermission('PERMISSION_BULK...')

19 /app/craftcms/vendor/yiisoft/yii2/base/BaseObject.php(109): venveo\bulkedit\Plugin->init()

20 /app/craftcms/vendor/yiisoft/yii2/base/Module.php(158): yii\base\BaseObject->__construct(Array)

21 /app/craftcms/vendor/craftcms/cms/src/base/Plugin.php(115): yii\base\Module->__construct('venveo-bulk-edi...', Object(craft\web\Application), Array)

22 [internal function]: craft\base\Plugin->__construct('venveo-bulk-edi...', Object(craft\web\Application), Array)

23 /app/craftcms/vendor/yiisoft/yii2/di/Container.php(420): ReflectionClass->newInstanceArgs(Array)

24 /app/craftcms/vendor/yiisoft/yii2/di/Container.php(171): yii\di\Container->build('venveo\bulkedit...', Array, Array)

25 /app/craftcms/vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get('venveo\bulkedit...', Array, Array)

26 /app/craftcms/vendor/craftcms/cms/src/Craft.php(67): yii\BaseYii::createObject(Array, Array)

27 /app/craftcms/vendor/craftcms/cms/src/services/Plugins.php(981): Craft::createObject(Array, Array)

28 /app/craftcms/vendor/craftcms/cms/src/services/Plugins.php(233): craft\services\Plugins->createPlugin('venveo-bulk-edi...', Array)

29 /app/craftcms/vendor/craftcms/cms/src/services/Plugins.php(301): craft\services\Plugins->loadPlugins()

30 /app/craftcms/vendor/superbig/craft3-bugsnag/src/Bootstrap.php(19): craft\services\Plugins->getPlugin('bugsnag')

31 /app/craftcms/vendor/yiisoft/yii2/base/Application.php(333): superbig\bugsnag\Bootstrap->bootstrap(Object(craft\web\Application))

32 /app/craftcms/vendor/craftcms/cms/src/web/Application.php(110): yii\base\Application->bootstrap()

33 /app/craftcms/vendor/yiisoft/yii2/base/Application.php(279): craft\web\Application->bootstrap()

34 /app/craftcms/vendor/craftcms/cms/src/web/Application.php(91): yii\base\Application->init()

35 /app/craftcms/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\web\Application->init()

36 /app/craftcms/vendor/yiisoft/yii2/base/Application.php(212): yii\base\BaseObject->__construct(Array)

37 [internal function]: yii\base\Application->__construct(Array)

38 /app/craftcms/vendor/yiisoft/yii2/di/Container.php(420): ReflectionClass->newInstanceArgs(Array)

39 /app/craftcms/vendor/yiisoft/yii2/di/Container.php(171): yii\di\Container->build('craft\web\Appli...', Array, Array)

40 /app/craftcms/vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get('craft\web\Appli...', Array, Array)

41 /app/craftcms/vendor/craftcms/cms/src/Craft.php(67): yii\BaseYii::createObject(Array, Array)

42 /app/craftcms/vendor/craftcms/cms/bootstrap/bootstrap.php(242): Craft::createObject(Array)

43 /app/craftcms/vendor/craftcms/cms/bootstrap/web.php(51): require('/app/craftcms/v...')

44 /app/craftcms/web/index.php(23): require('/app/craftcms/v...')

45 {main}

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

pohnean commented 2 years ago

Hi Devin,

I did some investigation and I could not reproduce it with SuperTables 2.6.8 + OmniSearch alone.

However, from the stacktrace it seems like there might be some other plugins interfering with OmniSearch...

Can I know what are the plugins you are using? From the trace, there is the venveo/craft-bulkedit plugin and the bugsnag plugin.

Can you try disabling those plugins and let me know if turning off the plugins fixes the issue?

If you can tell me which plugin is interfering with it, I might be able to reproduce it.

Thanks.

pohnean commented 2 years ago

I reckon that Omnisearch is somehow being loaded too early before the other plugins are loaded. So I've made a patch to force Omnisearch to initialize after all other plugins have been loaded.

Can you try out v1.2.4 and let me know if it fixes your issue?

devinpitcher commented 2 years ago

Sorry for the delay! I was on PTO last week. Appears to work now!