Skip to content
New issue

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

Use enableMagicCall when creating the propertyAccessor to make the exporter more flexible #674

Open
gravitiq-cm opened this issue Jul 17, 2024 · 1 comment
Labels

Comments

@gravitiq-cm
Copy link

Feature Request

Is there a reason not to enable use of methods accessed via magic __call() in the exporter?

Since everything has to be done through a property string, it's not possible to pass in arguments. Enabling use of __call() makes the exporter more flexible and gives power to the user to decide how to use it.

The change is relatively simple:

    public function __construct(
        protected array $fields,
        protected string $dateTimeFormat = 'r',
        protected bool $useBackedEnumValue = true
    ) {
        // original version:
        //     $this->propertyAccessor = PropertyAccess::createPropertyAccessor();

        $this->propertyAccessor = PropertyAccess::createPropertyAccessorBuilder()
            ->enableMagicCall()
            ->getPropertyAccessor()
        ;
    }
@VincentLanglet
Copy link
Member

Feel free to provide a PR (with a test) and I wont see a reason to refuse it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants