I was having a really hard time figuring out why my custom ElementType would not save. Figured out the generated element overrides the public function rules() of the \yii\base\Model::validate, but does not call the parent::rules().
Exception thrown was:
[error][yii\base\InvalidArgumentException] yii\base\InvalidArgumentException: Unknown scenario: essentials in [redacted]/vendor/yiisoft/yii2/base/Model.php:357
I was having a really hard time figuring out why my custom ElementType would not save. Figured out the generated element overrides the
public function rules()
of the\yii\base\Model::validate
, but does not call theparent::rules()
.Exception thrown was:
[error][yii\base\InvalidArgumentException] yii\base\InvalidArgumentException: Unknown scenario: essentials in [redacted]/vendor/yiisoft/yii2/base/Model.php:357
Generated
\modules\somemodule\elements\CustomElement::rules
was:should be: