Skip to content

Feature Request: Field for property #246

Closed

Description

@Ciantic

I don't want to go all in with Java-like getters and setters. I want to treat my Dto's more like JSON objects thus I would like to define field in properties:

class Product
{
    /**
     * @Field()
     */
    public int $id;

    /**
     * @Field()
     */
    public string $name = "";
}

I know that this is anti-pattern in OOP, but I don't care, my API is mostly readonly and I use the classes as a type safer alternative for typical spaghetti mixed array code.

I also don't seem to find a way to do this myself without forking graphqlite. The MagicFields are for classes, Field is for methods, and if I implement FromSourceFieldsInterface I should have to make another external class (it's not usable on the e.g. Product above directly.)

Activity

  1. oojacoboo commented on Mar 18, 2020

    @oojacoboo
    Collaborator

    We've made use of only properties with our input types. It works well. I know that's not the same thing, but I could see how this would be valuable.

  2. moufmouf commented on Jun 19, 2020

    @moufmouf
    Member

    Implementation pending in #269

  3. oojacoboo commented on Mar 29, 2021

    @oojacoboo
    Collaborator

    #269 is merged in now - closing this

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions