yiisoft / yiisoft/form-model

Add `EnumTypeCaster` to hydrator configuration

Open
#71 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
17
Forks
7
Avg merge
58m
Merged PRs (30d)
1

Description

It seems to me that this order will be good:

FormHydrator::class => [
        '__construct()' => [
            'hydrator' => DynamicReference::to([
                'class' => Hydrator::class,
                '__construct()' => [
                    'typeCaster' => new CompositeTypeCaster(
                        new NullTypeCaster(emptyString: true),
                        new PhpNativeTypeCaster(),
                        new NonArrayTypeCaster(),
                        new \Yiisoft\Hydrator\TypeCaster\EnumTypeCaster(),
                        new HydratorTypeCaster(),
                    ),
                ],
            ]),
        ],
    ],

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the FormHydrator configuration and the Hydrator construction described in the issue. Compare the type-caster order with the proposed EnumTypeCaster entry, then verify that enum-valued form fields are handled by the configured hydrator.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.