I use Cakephp 3.2.7 as a framework and create a query with the select alias.
$posts = $this->Posts->find()
->select(['id' => 'Posts.id','userid'=>"Posts.user_id"])->toArray();
I want to get id as a string not integer (the column type in mysql is an integer) and get the user id as an integer (the column type in mysql is also an integer), but use an alias that converts it to a string.
Is there a way to get all the Id columns in the entire model as a string, or at least determine the data type in the query?
source
share