Skip to content

Question: how to create dynamic or reusable Adapters and Schemas? #203

Description

@tekord

I have 10 models with completelly the same structure (Dictionary Entries like SkillEntry, ExperienceEntry, etc, they use different tables, but models are extended from single class) and 1 model which referencing to some of these dictionary models. I don't want to create 10 folders with Adapter and Schema, too many duplicate code. Is there any way to make schema and adapter dynamically? Or use the same Adapter and Schema but change their resource types dynamically? For instance:

User model has SkillEntry and ExperienceEntry relations (and another 8 entry relations). SkillEntry's resource type is 'dictionaries_skill-entries', ExperienceEntry's resource type is 'dictionaries_experience-entries'. These relations are available as normal relation of User resource by URL like this: /api/v1/users/42/relationships/skill-entry.

UPD. DictionaryEntry models has NO any relations. But if they were I also interesting in how to deal with it.

Thanks.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions