DictionaryBundle
DictionaryBundle copied to clipboard
Provide example or more documentation for custom dictionary
The documentation for defining a custom dictionary is pretty light:
https://github.com/KnpLabs/DictionaryBundle#dictionary
I've created a class that implements Dictionary, and I've set getKeys() and getValues() to return arrays with keys and values, but I'm not sure what I'm supposed to do with offsetGet().
This works, but doesn't feel right:
public function offsetGet(mixed $offset): mixed
{
return array_combine($this->getKeys(), $this->getValues())[$offset];
}
Is there an example you can point me to? Thx.