ADVERTISEMENT

Magento 2.3.3 Getting issue in custom module GraphQL

Try with below code.

type StoreHolidayInfo {
    dates: holidayDates,
    days: String,
    details: [holidayDetails]
}

type holidayDates {
    repetitive: [String] @doc(description: "holiday id"),
    normal: [String] @doc(description: "holiday id"),
    shipping_off_day: [String] @doc(description: "holiday id")
}

type holidayDetails {
    holiday_id: Int @doc(description: "holiday id"),
    holiday_name: String @doc(description: "holiday name"),
    holiday_applied_stores: String @doc(description: "holiday applied stores"),
    holiday_date_from: String @doc(description: "holiday date from"),
    holiday_date_to: String @doc(description: "holiday date to"),
    holiday_comment: String @doc(description: "holiday comment"),
    is_repetitive: Int @doc(description: "yearly repitive"),
    is_active: Int @doc(description: "is active holiday"),
    all_store: Int @doc(description: "all store"),
}

And add change below code in resolver.

return [
        'dates' => array(
            'repetitive' => $storeHoliday[0]['dates']['repetitive'],
            'normal' => $storeHoliday[0]['dates']['normal'],
            'shipping_off_day' => $storeHoliday[0]['dates']['shipping_off_day']
        ),
        'days' => $storeHoliday[0]['days'],
        'details' => $storeHoliday[0]['details']
    ];

It should work then.


i'm not sure but just try out

you will get idea

type StoreHolidayInfo {
   dates: [holidayDates]
   days: String
   details: [holidayDetails]
}


type holidayDates {
   repetitive: [repetitive_list]  
   normal: Int
   shipping_off_day: Int
}

type repetitive_list{
repetitive_list:int
}

i just gave for one element

just try then change to all

and also you need just change in your

array print [repetitive][repetitive_list]

[dates] => Array
                (
                    [repetitive] => Array
                        (
       [repetitive_list]=>Array(

                            [0] => 1-14
                            [1] => 1-15
                            [2] => 1-14
                            [3] => 1-15
                            [4] => 1-26
                        )
    )

                    [normal] => Array
                        (
                            [0] => 01-14-2020
                            [1] => 01-15-2020
                            [2] => 01-26-2020
                        )

                    [shipping_off_day] => Array
                        (
                        )

                )