Skip to content

Provide example or more documentation for custom dictionary #187

@tacman

Description

@tacman

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions