verbb / cp-nav

Control Panel Nav is a Craft CMS plugin to help manage your Control Panel navigation.
MIT License
129 stars 11 forks source link

Error with plugin after try apply changes via project config #84

Closed wmdhosting closed 3 years ago

wmdhosting commented 3 years ago

Description

When I try to apply changes to the database via the project config, I get an error.

2021-01-19 10:33:14 [-][-][-][error][yii\base\ErrorException:8] yii\base\ErrorException: Undefined index: sortOrder in /home/mysite/vendor/verbb/cp-nav/src/services/LayoutsService.php:171
Stack trace:
#0 /home/mysite/vendor/verbb/cp-nav/src/services/LayoutsService.php(171): yii\base\ErrorHandler->handleError(8, 'Undefined index...', '/home/mysite/...', 171, Array)
#1 /home/mysite/vendor/craftcms/cms/src/services/ProjectConfig.php(1166): verbb\cpnav\services\LayoutsService->handleChangedLayout(Object(craft\events\ConfigEvent))
#2 [internal function]: craft\services\ProjectConfig->handleChangeEvent(Object(craft\events\ConfigEvent))
#3 /home/mysite/vendor/yiisoft/yii2/base/Component.php(627): call_user_func(Array, Object(craft\events\ConfigEvent))
#4 /home/mysite/vendor/craftcms/cms/src/services/ProjectConfig.php(731): yii\base\Component->trigger('updateItem', Object(craft\events\ConfigEvent))
#5 /home/mysite/vendor/craftcms/cms/src/services/ProjectConfig.php(681): craft\services\ProjectConfig->_processConfigChangesInternal('cp-nav.layouts....', false, NULL, false)
#6 /home/mysite/vendor/verbb/cp-nav/src/helpers/ProjectConfig.php(30): craft\services\ProjectConfig->processConfigChanges('cp-nav.layouts....')
#7 /home/mysite/vendor/verbb/cp-nav/src/services/NavigationsService.php(167): verbb\cpnav\helpers\ProjectConfig::ensureAllLayoutsProcessed()
#8 /home/mysite/vendor/craftcms/cms/src/services/ProjectConfig.php(1166): verbb\cpnav\services\NavigationsService->handleChangedNavigation(Object(craft\events\ConfigEvent))
#9 [internal function]: craft\services\ProjectConfig->handleChangeEvent(Object(craft\events\ConfigEvent))
#10 /home/mysite/vendor/yiisoft/yii2/base/Component.php(627): call_user_func(Array, Object(craft\events\ConfigEvent))
#11 /home/mysite/vendor/craftcms/cms/src/services/ProjectConfig.php(731): yii\base\Component->trigger('updateItem', Object(craft\events\ConfigEvent))
#12 /home/mysite/vendor/craftcms/cms/src/services/ProjectConfig.php(1275): craft\services\ProjectConfig->_processConfigChangesInternal('cp-nav.navigati...', false, NULL, true)
#13 /home/mysite/vendor/craftcms/cms/src/services/ProjectConfig.php(562): craft\services\ProjectConfig->_applyChanges(Array)
#14 /home/mysite/vendor/craftcms/cms/src/console/controllers/ProjectConfigController.php(148): craft\services\ProjectConfig->applyYamlChanges()
#15 [internal function]: craft\console\controllers\ProjectConfigController->actionApply()
#16 /home/mysite/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#17 /home/mysite/vendor/yiisoft/yii2/base/Controller.php(180): yii\base\InlineAction->runWithParams(Array)
#18 /home/mysite/vendor/yiisoft/yii2/console/Controller.php(179): yii\base\Controller->runAction('apply', Array)
#19 /home/mysite/vendor/craftcms/cms/src/console/Controller.php(188): yii\console\Controller->runAction('apply', Array)
#20 /home/mysite/vendor/yiisoft/yii2/base/Module.php(528): craft\console\Controller->runAction('apply', Array)
#21 /home/mysite/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('project-config/...', Array)
#22 /home/mysite/vendor/craftcms/cms/src/console/Application.php(88): yii\console\Application->runAction('project-config/...', Array)
#23 /home/mysite/vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction('project-config/...', Array)
#24 /home/mysite/vendor/yiisoft/yii2/base/Application.php(386): yii\console\Application->handleRequest(Object(craft\console\Request))
#25 /home/mysite/craft(22): yii\base\Application->run()
#26 {main}

Steps to reproduce

  1. Make changes locally in the database.
  2. Send the updated config to the server.
  3. Apply changes.

Additional info

engram-design commented 3 years ago

Strange, seems like sortOrder is missing from your project config yaml files. Are you able to confirm by having a look in config/project/cp-nav/layouts in each file there, for each of your layouts, and see if there's a missing sortOrder in any or all of your layouts?

How many layouts do you have? Was this a recent upgrade from an older version of the plugin, or a new install?

wmdhosting commented 3 years ago

image

First: isDefault: false name: Korisnik permissions: '["114feabf-b36b-4e80-a522-c35d7ecf6012"]'

Second: isDefault: true name: Default permissions: 'null'

When a new version is released, I always update the plugin.

engram-design commented 3 years ago

Should be fixed in 3.0.14

wmdhosting commented 3 years ago

Hello :)

Started getting again error I get the error https://prnt.sc/10u54ru

Brad told me, can be other places that need orginal fix..

Thx for help..

Additional info Control Panel Nav 3.0.15 Craft Pro 3.6.10