Code stop working after using leftJoin.

Code stop working after using leftJoin.

oopsleonoopsleon Posts: 9Questions: 4Answers: 0

Hi team,
When I use leftJoin method, my code stopping working. But working all right without using leftJoin.
I have added database table's name, like tableName.fieldName.
But it still shows error: A system error has occurred (More information).
If I only keep the first line of code "Field::inst('timesheet.end_time')", it works all right.
And I also have tried changing $data['start_time'] to $data['timesheet.start_time'], still not working.
Could you please help? It must be some details I did not pay attention~~Thank you very much!

            Field::inst('timesheet.end_time')
                // code below caused the error, but working all right without using leftJoin
                ->validator(
                    Validate::dateFormat(
                        'g:i A',
                        ValidateOptions::inst()
                            ->allowEmpty(false)
                    ),
                )
                ->getFormatter(Format::datetime('H:i:s', 'g:i A'))
                ->setFormatter(Format::datetime('g:i A', 'H:i:s'))
                ->validator(function ($val, $data, $opts) {
                    if (strtotime($val) <= strtotime($data['start_time'])) {
                        return "End time must be later than start time.";
                    }
                    return true;
                }),

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,003Questions: 1Answers: 9,949 Site admin
    edited January 2023 Answer ✓

    Line 8:), - I think that might be causing the error due to a PHP syntax error. Try removing the comma.

    If that doesn't fix it, have a look at what the response from the Ajax request is in the browser's network inspector. That should show you an error message.

    Regards,
    Allan

Sign In or Register to comment.