예제 #1
0
 public static function initialize(Jelly_Meta $meta)
 {
     // Set database to connect to
     $meta->db(Unittest_Jelly_Testcase::$database_connection);
     // Define fields
     $meta->fields(array('id' => Jelly::field('primary'), 'name' => Jelly::field('string'), 'test_posts' => Jelly::field('manytomany'), 'parent' => Jelly::field('belongsto', array('foreign' => 'test_category', 'column' => 'parent_id'))));
 }
예제 #2
0
파일: author.php 프로젝트: piotrtheis/jelly
 public static function initialize(Jelly_Meta $meta)
 {
     // Set database to connect to
     $meta->db(Unittest_Jelly_Testcase::$database_connection);
     // Define fields
     $meta->fields(array('id' => Jelly::field('primary'), 'name' => Jelly::field('string'), 'password' => Jelly::field('password'), 'email' => Jelly::field('email'), 'test_posts' => Jelly::field('hasmany'), 'test_post' => Jelly::field('hasone'), 'permission' => Jelly::field('belongsto', array('foreign' => 'test_role', 'column' => 'test_role_id')), '_id' => 'id'));
 }
예제 #3
0
파일: role.php 프로젝트: piotrtheis/jelly
 public static function initialize(Jelly_Meta $meta)
 {
     // Set database to connect to
     $meta->db(Unittest_Jelly_Testcase::$database_connection);
     // Define fields
     $meta->fields(array('id' => Jelly::field('primary'), 'name' => Jelly::field('string')));
 }
예제 #4
0
파일: alias.php 프로젝트: piotrtheis/jelly
 public static function initialize(Jelly_Meta $meta)
 {
     // Set database to connect to
     $meta->db(Unittest_Jelly_Testcase::$database_connection);
     // All fields are aliased to different columns
     $meta->fields(array('id' => Jelly::field('primary', array('column' => 'id-alias')), 'name' => Jelly::field('string', array('column' => 'name-alias')), 'description' => Jelly::field('string', array('column' => 'description-alias')), '_id' => 'id', '_name' => 'name', '_description' => 'description', '_bar' => 'foo'));
 }
예제 #5
0
 /**
  * Casts the returned value to a given type.
  *
  * @param   mixed   $value
  * @return  mixed
  */
 public function set($value)
 {
     if (isset($this->cast)) {
         // Cast the value using the field type defined in 'cast'
         $value = Jelly::field($this->cast)->set($value);
     }
     return $value;
 }
예제 #6
0
파일: post.php 프로젝트: piotrtheis/jelly
 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'));
 }
예제 #7
0
 /**
  * Initializating model meta information
  *
  * @param Jelly_Meta $meta
  */
 public static function initialize(Jelly_Meta $meta)
 {
     $meta->table('users')->fields(array('id' => Jelly::field('Primary'), 'email' => Jelly::field('Email'), 'name' => Jelly::field('String'), 'password' => Jelly::field('Password')));
 }
예제 #8
0
파일: Jelly.php 프로젝트: wouterrr/a1
 /**
  * @param Jelly_Meta $meta
  */
 public static function initialize(Jelly_Meta $meta)
 {
     $meta->fields(array('id' => new Field_Primary(), 'username' => Jelly::field('string', array('unique' => TRUE, 'rules' => array(array('not_empty'), array('min_length', array(':value', 4)), array('max_length', array(':value', 4))))), 'password' => Jelly::field('password', array('hash_with' => array('Model_A1_User_Jelly', 'hash_password'), 'rules' => array(array('not_empty'), array('min_length', array(':value', 6)), array('max_length', array(':value', 50))))), 'password_confirm' => Jelly::field('password', array('in_db' => FALSE, 'rules' => array(array('not_empty'), array('min_length', array(':value', 6)), array('max_length', array(':value', 50)), array('matches', array(':validation', 'password', ':field')))))));
 }