Burgov / KeyValueFormBundle

A form type for managing key-value pairs
MIT License
44 stars 32 forks source link

change signature for key-value pairs #3

Closed ElectricMaxxx closed 10 years ago

ElectricMaxxx commented 10 years ago

As seen in https://github.com/symfony-cmf/cmf-sandbox/pull/255 and discussed in Burgov/KeyValueFormBundle#2 there is a bug in the signature for adding/removing key-value pairs.

To get a signature for adder like add*($key, $value) we need an other result for the transformer.

ElectricMaxxx commented 10 years ago

Btw, i added a phpunit.xml and a .gitignore file.

Burgov commented 10 years ago

Thanks for the PR, but it doesn't seem to fix the problem. I've narrowed it down to this line of code in the symfony component: https://github.com/symfony/symfony/blob/8ef8a1d289a6ce454b7c79baeddbfb45e4af6191/src/Symfony/Component/PropertyAccess/PropertyAccessor.php#L561

As you can see, the method that tries to find an adder and remover is hardcoded to allow only one argument, so converting the hash to a hash that contains it's own keys in the values doesn't help us here

ElectricMaxxx commented 10 years ago

@Burgov how was it planed to inject both the key and the value?

Burgov commented 10 years ago

@ElectricMaxxx See my comment on #2. The problem is I wasn't expecting for the adders and removers to be there. Right now the symfony propertyaccess component simply cannot handle them in this way