Important

We are updating the images for OroCommerce version 6.1 to align with the latest changes in the back-office design. During this transition, some images may still show older versions. Thank you for your patience as we work to update all visuals to reflect these changes.

Dictionaries 

Dictionary entities are responsible for storing a predefined set of values of a particular type and their translations. The values within a dictionary can have a priority or some other data.

Automatic Creation of REST API for Dictionaries 

REST API resources for viewing dictionary values are created automatically and are accessible by the following URL: /api/{dictionary_plural_alias}. For example /api/casestatuses.

Please refer to entity aliases topic to better understand how the aliases are generated.

Dictionary types supported out-of-the-box

REST API resources are created automatically for the following types of dictionaries:

  • Non-translatable dictionary

  • Translatable dictionary (implements Gedmo\Translatable\Entity\MappedSuperclass\AbstractTranslation)

  • Personal translatable dictionary (implements Gedmo\Translatable\Entity\MappedSuperclass\AbstractPersonalTranslation)

  • Enum (Option set)

Creating a custom dictionary type

If you have a group of entities that can be classified as a dictionary but are not included in the dictionary group in the entity configuration, and you need to have its entities added to the dictionary REST API, you need to do two things.

  1. Create a dictionary value list provider implementing the DictionaryValueListProviderInterface interface.

  2. Register your provider service in the DI container by the following tag: oro_entity.dictionary_value_list_provider:

src/Acme/Bundle/DemoBundle/Resources/config/services.yml 
# Resources/config/services.yml
services:

    acme_demo.dictionary_value_list_provider:
        class: Acme\Bundle\DemoBundle\Provider\AcmeDictionaryValueListProvider
        public: false
        arguments:
            - '@oro_entity_config.config_manager'
            - '@doctrine'
        tags:
            - { name: oro_entity.dictionary_value_list_provider, priority: 200 }

Note

Please note that you can specify the priority for the dictionary value list provider. The bigger the priority number is, the earlier the provider will be executed.

If more than one dictionary value list provider supports the same type of dictionary, only the one with the greater priority will be executed. The priority value is optional and defaults to 0.