Tuesday, April 5, 2011

Re: TinyInt's not converted to Boolean

there is nothing to be fixed

simply check on the value using empty() or !empty()
if (!empty($value)) { echo 'YES'; } else { echo 'NO'; }


On 5 Apr., 11:33, cakey <tijmen.ruizend...@gmail.com> wrote:
> I have a model with a few tinyint(1) fields. I use this simple find:
> $this->Model->find('all'). But the tinyint fields are returned like
> this with var_dump:
>
> ["enabled"]=>
>       string(1) "1"
>
> This is the field in the table:
>
> `enabled` tinyint(1) NOT NULL DEFAULT '1',
>
> This is what the docs tell me athttp://book.cakephp.org/nl/view/1003/Data-Type-Associations-by-Database
> :
> A tinyint(1) field is considered a boolean by CakePHP.
>
> What am I doing wrong? Where should I look to fix this?
>
> Thanks!

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: