{"record":{"id":"2cc1c478f8532f50","repo":"yiisoft/yii2","slug":"get-class-this-assetmanager-should-be-eithe","errorCode":null,"errorMessage":"\"{get_class($this)}::assetManager\" should be either object or array - \"{gettype($assetManager)}\" given.","messagePattern":"\"(.+?)::assetManager\" should be either object or array - \"(.+?)\" given\\.","errorType":"console","errorClass":"yii\\console\\Exception","httpStatus":null,"severity":"error","filePath":"framework/console/controllers/AssetController.php","lineNumber":182,"sourceCode":"            if (!isset($options['forceCopy'])) {\n                $options['forceCopy'] = true;\n            }\n\n            $this->_assetManager = Yii::createObject($options);\n        }\n\n        return $this->_assetManager;\n    }\n\n    /**\n     * Sets asset manager instance or configuration.\n     * @param \\yii\\web\\AssetManager|array $assetManager asset manager instance or its array configuration.\n     * @throws \\yii\\console\\Exception on invalid argument type.\n     */\n    public function setAssetManager($assetManager)\n    {\n        if (is_scalar($assetManager)) {\n            throw new Exception('\"' . get_class($this) . '::assetManager\" should be either object or array - \"' . gettype($assetManager) . '\" given.');\n        }\n        $this->_assetManager = $assetManager;\n    }\n\n    /**\n     * Combines and compresses the asset files according to the given configuration.\n     * During the process new asset bundle configuration file will be created.\n     * You should replace your original asset bundle configuration with this file in order to use compressed files.\n     * @param string $configFile configuration file name.\n     * @param string $bundleFile output asset bundles configuration file name.\n     */\n    public function actionCompress($configFile, $bundleFile)\n    {\n        $this->loadConfiguration($configFile);\n        $bundles = $this->loadBundles($this->bundles);\n        $targets = $this->loadTargets($this->targets, $bundles);\n        foreach ($targets as $name => $target) {\n            $this->stdout(\"Creating output bundle '{$name}':\\n\");","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/yiisoft/yii2/blob/66f00d18a29b520f85e8e8f1e32d1e7e7b556cac/framework/console/controllers/AssetController.php#L164-L200","documentation":"Error \"\"{get_class($this)}::assetManager\" should be either object or array - \"{gettype($assetManager)}\" given.\" thrown in yiisoft/yii2.","triggerScenarios":"Thrown at framework/console/controllers/AssetController.php:182 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":"66f00d18a29b520f85e8e8f1e32d1e7e7b556cac","analyzedAt":"2026-08-17T05:17:23.470Z","schemaVersion":2},"datasetVersion":"2026-08-17T09:17:11.063Z"}