Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

Doctrine time type generate error with inplace editor #905

Closed
psyray opened this issue Jul 15, 2019 · 0 comments · May be fixed by #906
Closed

Doctrine time type generate error with inplace editor #905

psyray opened this issue Jul 15, 2019 · 0 comments · May be fixed by #906

Comments

@psyray
Copy link

psyray commented Jul 15, 2019

When I try to add a time element in datatable with inplace editor, when I edit a value the following error is returned

DatatableController::prepareValue(): The field type time is not editable.

To solve the issue I have added the Type::TIME in the DatatableController at this position.

So the final method looks like this

    private function normalizeValue($originalTypeOfField, $value)
    {
        switch ($originalTypeOfField) {
            case Type::DATETIME:
            case Type::TIME:
                $value = new DateTime($value);
                break;
            case Type::BOOLEAN:
                $value = $this->strToBool($value);
                break;
            case Type::TEXT:
            case Type::STRING:
                break;
            case Type::SMALLINT:
            case Type::INTEGER:
                $value = (int) $value;
                break;
            case Type::BIGINT:
                $value = (string) $value;
                break;
            case Type::FLOAT:
            case Type::DECIMAL:
                $value = (float) $value;
                break;
            default:
                throw new Exception("DatatableController::prepareValue(): The field type {$originalTypeOfField} is not editable.");
        }

        return $value;
    }

I will submit a PR
After this addition no problem, saving is fine.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants