本文整理汇总了PHP中Jelly::field方法的典型用法代码示例。如果您正苦于以下问题:PHP Jelly::field方法的具体用法?PHP Jelly::field怎么用?PHP Jelly::field使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Jelly
的用法示例。
在下文中一共展示了Jelly::field方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
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: initialize
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: initialize
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: initialize
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: set
/**
* 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: initialize
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: initialize
/**
* 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: initialize
/**
* @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')))))));
}