Skip to content

Adding a field with args to an EntityRefObjectType #40

@rhermelingcoolblue

Description

@rhermelingcoolblue

Hi I have a product entity

new EntityRefObjectType([
                'name' => 'Product',
                'keyFields' => ['id'],
                'fields' => [
                    'id' => fn() => [
                        'description' => 'The ID of the Product.',
                        'type' => Type::nonNull(Type::int()),
                    ],
                    'accessorySlot' => fn() => [
                        'description' =>
                            'Accessory alternatives that share a product type and or fiter set and or classification',
                        'type' => $this->createConfiguratorSlotType(),
                        'resolve' => $this->productAccessorySlotResolver,
                        'args' => [ 'criteria' => [
            'name' => 'AccessorySlotCriteria',
            'description' => 'The criteria an accessory slot should satisfy.',
            'keyFields' => ['productTypeId limit classificationId filterSetId'],
            'fields' => [
                'productTypeId' => fn() => [
                    'description' => "The accessory's product type.",
                    'type' => Type::nonNull(Type::int()),
                ],
            ],
        ] ]
                    ]
                ]
            ]);

And I this field (accessorySlot) Im contributing requires extra args namely productTypeId to be resolved. I used this configuration, but it seems that the args from the accessorySlot property are not picked up in the GraphQL schema
image

Is this intended behavior or is it simply not build yet? If the latter can you point me in the right direction to contribute this feature?

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