Skip to content

Implement configurable interfaces #4

Open
@hakobyansen

Description

@hakobyansen

There should be an ability to set interface that the generated DTO class will implement.

For example, each DTO class can use the ToArray trait and contain toArray() method. So you may want to make sure that your DTO class implements some interface named e.g. Arrayable (though, Laravel framework has Arrayable interface).

The user should be able to define "interfaces" like this:

{
    "class": "item",
    "namespace_postfix": "",
    "interfaces": "\Path\To\Arrayable",
    "rules": {
        "id": "int",
        "count": "nullable|int",
        "name": "string",
        "description": "nullable|string",
        "is_active": "bool"
    }
}

where \Path\To\Arrayable is the namespace of the interface.

Separate interfaces with comma, when there is a need to implement multiple interfaces:

"interfaces": "\Path\To\FirstInterface, \Path\To\SecondInterface",

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions