Example #1
0
 public static function initialize(Jelly_Meta $meta)
 {
     // Set database to connect to
     $meta->db(Unittest_Jelly_Testcase::$database_connection);
     // Posts always load_with an author
     $meta->load_with(array('test_author'));
     // Set fields
     $meta->fields(array('id' => Jelly::field('primary'), 'name' => Jelly::field('string'), 'slug' => Jelly::field('slug', array('unique' => TRUE)), 'status' => Jelly::field('enum', array('choices' => array('draft', 'published', 'review'))), 'created' => Jelly::field('timestamp', array('auto_now_create' => TRUE)), 'updated' => Jelly::field('timestamp', array('auto_now_update' => TRUE)), 'test_author' => Jelly::field('belongsto'), 'test_categories' => Jelly::field('manytomany'), 'approved_by' => Jelly::field('belongsto', array('foreign' => 'test_author.id', 'column' => 'approved_by')), '_id' => 'id', '_slug' => 'slug'));
 }