Add a MySQL field of type "bit" to a FuelPHP model -


my schema has column of type "bit(1)". haven't found way can expressed in fuel. don't seem support "bit" type , can't build insert queries.

is there way (possibly undocumented) fuel support this?

hmm... orm supposedly accepts bit field.

i have created model database. migration script , model, maybe can you.

model

class model_test extends \orm\model {     protected static $_properties = array(         'id',         'whatever',     );      protected static $_table_name = 'tests';  } 

migration script

builded existing table using command: oil refine fromdb:model test

namespace fuel\migrations;  class create_tests {     public function up()     {         \dbutil::create_table('tests', array(             'id' => array('constraint' => 11, 'type' => 'int', 'auto_increment' => true, 'unsigned' => true),             'whatever' => array('type' => 'bit'),          ), array('id'));     }      public function down()     {         \dbutil::drop_table('tests');     } } 

in controller, must need cast value int

$f  = input::post('whatever_post_field');  $o  = model_test::forge(array('whatever' => (int)$f)); $o->save(); 

Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -