CakePHP and tinyint as boolean

cakephp, php

Solution

Use `TINYINT(2)` instead. If the length is 1, Cake sees it as a boolean.

Problem

How can I force CakePHP 2.x to retrieve tinyint database column not as boolean but as tinyint? MySQL: ``` Column | type ------------------------------- ... | ... category_id | tinyint(1) ... | ... ``` CakePHP: ``` $this->request->data = $this->Question->read(); var_dump($this->request->data['Question']['category']); ``` The value is always 0 (if the question I'm fetching as the category id 0) or 1 (if the question has any other category id).

Original source