class Model_Article extends Orm\Model
{
protected static $_properties = array(
'id', // both validation & typing observers will ignore the PK
'name' => array(
'data_type' => 'varchar',
'label' => 'Article Name',
'validation' => array('required', 'min_length' => array(3), 'max_length' => array(20)),
'form' => array('type' => 'text'),
'default' => 'New article',
),
'gender' => array(
'data_type' => 'varchar',
'label' => 'Gender',
'form' => array('type' => 'select', 'options' => array('m' => 'Male', 'f' => 'Female')),
'validation' => array('required'),
),
'created_at' => array(
'data_type' => 'int',
'label' => 'Created At',
'form' => array(
'type' => false, // this prevents this field from being rendered on a form
),
),
'updated_at' => array('data_type' => 'int', 'label' => 'Updated At')
);
}
I noticed this because i've an orm observer on a user model triggered on after_insert and after_update events that inserts/updates a mongodb , and the method where_lte was fetching weird results because it was indexed as a string
$mongodb = \Mongo_Db::instance();
$mongodb->where_lt('created_at', time());
$users = $mongodb->get('users');
It looks like you're new here. If you want to get involved, click one of these buttons!