{"record":{"id":"8a54a74f16101c0b","repo":"getgrav/grav","slug":"switching-flex-page-object-during-onadminsave-even","errorCode":null,"errorMessage":"Switching Flex Page object during onAdminSave event is not supported! Please update plugin.","messagePattern":"Switching Flex Page object during onAdminSave event is not supported! Please update plugin\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"system/src/Grav/Common/Flex/Types/Pages/PageObject.php","lineNumber":310,"sourceCode":"        }\n    }\n\n    /**\n     * @param array|bool $reorder\n     * @return static\n     */\n    public function save($reorder = true)\n    {\n        $variables = $this->onBeforeSave(func_get_args());\n\n        // Backwards compatibility with older plugins.\n        $fireEvents = $reorder && $this->isAdminSite() && $this->getFlexDirectory()->getConfig('object.compat.events', true);\n        $grav = $this->getContainer();\n        if ($fireEvents) {\n            $self = $this;\n            $grav->fireEvent('onAdminSave', new Event(['type' => 'flex', 'directory' => $this->getFlexDirectory(), 'object' => &$self]));\n            if ($self !== $this) {\n                throw new RuntimeException('Switching Flex Page object during onAdminSave event is not supported! Please update plugin.');\n            }\n        }\n\n        /** @var static $instance */\n        $instance = parent::save();\n        $variables = $this->onSave($variables);\n\n        $this->onAfterSave($variables);\n\n        // Backwards compatibility with older plugins.\n        if ($fireEvents) {\n            $grav->fireEvent('onAdminAfterSave', new Event(['type' => 'flex', 'directory' => $this->getFlexDirectory(), 'object' => $this]));\n        }\n\n        // Reset original after save events have all been called.\n        $this->_originalObject = null;\n\n        return $instance;","sourceCodeStart":292,"sourceCodeEnd":328,"githubUrl":"https://github.com/getgrav/grav/blob/6040efed04efa69b8209448ed81308e7c24147c2/system/src/Grav/Common/Flex/Types/Pages/PageObject.php#L292-L328","documentation":"Error \"Switching Flex Page object during onAdminSave event is not supported! Please update plugin.\" thrown in getgrav/grav.","triggerScenarios":"Thrown at system/src/Grav/Common/Flex/Types/Pages/PageObject.php:310 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6040efed04efa69b8209448ed81308e7c24147c2","analyzedAt":"2026-08-17T05:07:31.593Z","schemaVersion":2},"datasetVersion":"2026-08-17T09:17:11.063Z"}