0

I created a REST API in CakePHP 4.5, and all the ID fields are of type Bigint. Is there a way to force CakePHP to convert these fields to strings before returning the JSON?

There are many fields, and it would be impractical to edit each possible return function. I thought about defining this conversion in the EntityTable or the model.

Is that possible?

I tried this, but cake still returning id as INT

public function getSchema():TableSchema{
        $schema = parent::getSchema();
        $schema->setColumnType('id', 'string');
        return $schema;
    }
0

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.