Skip to content

Expose denormalizePropertyName/normalizePropertyName in a Trait #7594

@VincentLanglet

Description

@VincentLanglet

Description
While writing custom filters, I have the need for the denormalizePropertyName/normalizePropertyName method.
But currently to have them I have to extends AbstractFilter.

I feel like it would be more useful to have them directly in a trait in doctrine/common, and this trait could be used by both
ApiPlatform\Doctrine\Orm\Filter\AbstractFilter
ApiPlatform\Doctrine\Odm\Filter\AbstractFilter

I thought about adding them to PropertyHelperTrait but it requires adding a property nameConverter to this trait which means

  • protected ?NameConverterInterface $nameConverter = null, needs to be changed in AbstractFilter to
public function __construct(
        ...
        ?NameConverterInterface $nameConverter = null,
    ) {
        $this->nameConverter = $nameConverter;
    }

and therefore doctrine/orm & odm package 4.2.9 won't work with 4.2.10 version of doctrine/common ; not sure if it's ok to make such change and add such requirement/conflict between packages

  • If someone use the PropertyHelperTrait AND has a property nameConverter it will break

The other option would be to introduce a new Trait, but I'm not sure what would be a good name for it, based on the fact the first trait is pretty generic with PropertyHelperTrait... any suggestion @soyuka ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions