We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello,
I'm getting the next error after updating from 2.0.44 to 2.0.48.1: Object of class "..." could not be converted to int
Please check BaseHtml:1938 https://github.com/yiisoft/yii2/blob/73902f0730454f499d1a8bb49382e5021943656e/framework/helpers/BaseHtml.php#L1938C44-L1938C44
var_dump($selection)
/project/vendor/yiisoft/yii2/helpers/BaseHtml.php:1938: object("...")[315] protected 'value' => int 0 protected string 'label' => string 'First' (length=7)
var_dump($key)
/project/vendor/yiisoft/yii2/helpers/BaseHtml.php:1939:int 0
Workaround:
$selected = is_object($selection) ? $selection->value == $key : $selection == $key;
Should i keep this workaround or im getting the error due of my Enum:
/** * @method static self first() * @method static self second() * @method static self third() */ class BookSubject extends Enum { /** * @codeCoverageIgnore */ protected static function values(): array { return [ 'first' => 0, 'second' => 1, 'third' => 2 ]; } /** * @codeCoverageIgnore */ protected static function labels(): array { return [ 'first' => \Yii::t('app', 'first'), 'second' => \Yii::t('app', 'second'), 'third' => \Yii::t('app', 'third') ]; } }
The text was updated successfully, but these errors were encountered:
Enums are not supported yet but we will be happy to provide it. Do you have a time to prepare the PR maybe?
Sorry, something went wrong.
Sure, i have just created the PR: #19928
Could i use this fix for 2.0.48.1 or do i have to wait for the next release? Thanks
No branches or pull requests
Hello,
I'm getting the next error after updating from 2.0.44 to 2.0.48.1: Object of class "..." could not be converted to int
Please check BaseHtml:1938
https://github.com/yiisoft/yii2/blob/73902f0730454f499d1a8bb49382e5021943656e/framework/helpers/BaseHtml.php#L1938C44-L1938C44
var_dump($selection)
var_dump($key)
Workaround:
Should i keep this workaround or im getting the error due of my Enum:
The text was updated successfully, but these errors were encountered: