Trying to customize the FOSUserbundle User Entity, I want to assert the username with a constraint and some data in an array as payload.
Doing it with annotations, I would do it so :
class User
{
/**
* @Assert\Length(..., payload={"my_array":{"Hello1","Hello2"}})
*/
protected $username;
}
But to extend the FOSUserbundle constraints, it must be done with XML :
<constraint name="Length">
...
<option name="payload"><!-- What I tried but it doesn't work -->
<value>
<option name="my_array">
<value>Hello1</value>
<value>Hello2</value>
</option>
</value>
</option>
</constraint>
I cannot use 'option name="..."' to define a hashtable ? How can I write it ? Nothing found in Symfony doc.
The error with the try above : Element '{http://symfony.com/schema/dic/constraint-mapping}option': This element is not expected. Expected is one of ( {http://symfony.com/schema/dic/constraint-mapping}constraint
But the link http://symfony.com/schema/dic/constraint-mapping is dead.