当前位置: 首页>>代码示例>>PHP>>正文


PHP Jam::field方法代码示例

本文整理汇总了PHP中Jam::field方法的典型用法代码示例。如果您正苦于以下问题:PHP Jam::field方法的具体用法?PHP Jam::field怎么用?PHP Jam::field使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Jam的用法示例。


在下文中一共展示了Jam::field方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: initialize

 public static function initialize(Jam_Meta $meta)
 {
     // Set database to connect to
     $meta->db(Kohana::TESTING);
     // Define fields
     $meta->fields(array('id' => Jam::field('primary'), 'name' => Jam::field('string'), 'model' => Jam::field('polymorphic')));
 }
开发者ID:Konro1,项目名称:pms,代码行数:7,代码来源:Position.php

示例2: initialize

 public static function initialize(Jam_Meta $meta)
 {
     $meta->table('vocabularies')->name_key('name');
     $meta->behaviors(array('paranoid' => Jam::behavior('paranoid', array())));
     $meta->associations(array('terms' => Jam::association('hasmany', array('inverse_of' => 'vocabulary'))));
     $meta->fields(array('id' => Jam::field('primary'), 'name' => Jam::field('string'), 'is_hidden' => Jam::field('boolean', array()), 'created_at' => Jam::field('timestamp', array('auto_now_create' => TRUE, 'format' => 'Y-m-d H:i:s')), 'updated_at' => Jam::field('timestamp', array('auto_now_update' => TRUE, 'format' => 'Y-m-d H:i:s', 'label' => "Last edited"))));
 }
开发者ID:openbuildings,项目名称:jam-taxonomy,代码行数:7,代码来源:Vocabulary.php

示例3: initialize

 public static function initialize(Jam_Meta $meta)
 {
     // Set database to connect to
     $meta->db(Kohana::TESTING);
     // Define fields
     $meta->fields(array('id' => Jam::field('primary'), 'file' => Jam::field('upload', array('server' => 'test_local')), 'file2' => Jam::field('upload', array('server' => 'test_local', 'path' => 'test/:model/:model:id'))));
 }
开发者ID:Konro1,项目名称:pms,代码行数:7,代码来源:Upload.php

示例4: initialize

 public static function initialize(Jam_Meta $meta)
 {
     // Set database to connect to
     $meta->db(Kohana::TESTING);
     // All fields are aliased to different columns
     $meta->fields(array('id' => Jam::field('primary', array('column' => 'id-alias')), 'name' => Jam::field('string', array('column' => 'name-alias')), 'description' => Jam::field('string', array('column' => 'description-alias'))));
 }
开发者ID:Konro1,项目名称:pms,代码行数:7,代码来源:Alias.php

示例5: initialize

 /**
  * Automatically sets foreign to sensible defaults.
  *
  * @param   string  $model
  * @param   string  $name
  * @return  void
  */
 public function initialize(Jam_Meta $meta, $name)
 {
     parent::initialize($meta, $name);
     if (!$this->foreign_key) {
         $this->foreign_key = $name . '_id';
     }
     if ($this->foreign_key === $name) {
         throw new Kohana_Exception('In association ":name" for model ":model" - invalid foreign_key name. Field and Association cannot be the same name', array(':model' => $this->model, ':name' => $name));
     }
     $meta->field($this->foreign_key, Jam::field('integer', array_merge($this->_default_field_options, $this->field_options)));
     if ($this->is_polymorphic()) {
         if (!is_string($this->polymorphic)) {
             $this->polymorphic = $name . '_model';
         }
         $meta->field($this->polymorphic, Jam::field('string', array('convert_empty' => TRUE)));
     } elseif (!$this->foreign_model) {
         $this->foreign_model = $name;
     }
     if ($this->count_cache) {
         if ($this->is_polymorphic()) {
             throw new Kohana_Exception('Cannot use count cache on polymorphic associations');
         }
         if ($this->count_cache === TRUE) {
             $this->count_cache = Inflector::plural($this->model) . '_count';
         }
     }
 }
开发者ID:openbuildings,项目名称:jam,代码行数:34,代码来源:Belongsto.php

示例6: initialize

 public static function initialize(Jam_Meta $meta)
 {
     // Set database to connect to
     $meta->db(Kohana::TESTING);
     $meta->associations(array('test_owner' => Jam::association('belongsto', array('foreign_model' => 'test_author', 'foreign_key' => 'test_owner_id')), 'test_featured_category' => Jam::association('hasone', array('foreign_model' => 'test_category')), 'test_posts' => Jam::association('hasmany', array('inverse_of' => 'test_blog', 'count_cache' => TRUE, 'dependent' => Jam_Association::DELETE)), 'test_categories' => Jam::association('hasmany', array('required' => TRUE, 'inverse_of' => 'test_blog')), 'test_tags' => Jam::association('manytomany', array())));
     // Define fields
     $meta->fields(array('id' => Jam::field('primary'), 'name' => Jam::field('string'), 'url' => Jam::field('weblink'), 'test_posts_count' => Jam::field('integer')));
 }
开发者ID:Konro1,项目名称:pms,代码行数:8,代码来源:Blog.php

示例7: initialize

 public static function initialize(Jam_Meta $meta)
 {
     $meta->table('terms')->name_key('name');
     $meta->behaviors(array('nested' => Jam::behavior('Nested'), 'sluggable' => Jam::behavior('Sluggable', array('uses_primary_key' => FALSE, 'auto_save' => FALSE, 'unique' => TRUE))));
     $meta->associations(array('vocabulary' => Jam::association('belongsto', array('inverse_of' => 'terms'))));
     $meta->fields(array('id' => Jam::field('primary'), 'name' => Jam::field('string'), 'is_hidden' => Jam::field('boolean', array()), 'created_at' => Jam::field('timestamp', array('auto_now_create' => TRUE, 'format' => 'Y-m-d H:i:s')), 'updated_at' => Jam::field('timestamp', array('auto_now_update' => TRUE, 'format' => 'Y-m-d H:i:s'))));
     $meta->validator('name', array('present' => TRUE));
 }
开发者ID:openbuildings,项目名称:jam-taxonomy,代码行数:8,代码来源:Term.php

示例8: initialize

 public static function initialize(Jam_Meta $meta)
 {
     // Set database to connect to
     $meta->db(Kohana::TESTING);
     $meta->associations(array('test_image' => Jam::association('belongsto', array('dependent' => Jam_Association::DELETE))));
     // Set fields
     $meta->fields(array('id' => Jam::field('primary'), 'name' => Jam::field('string')));
 }
开发者ID:Konro1,项目名称:pms,代码行数:8,代码来源:Copyright.php

示例9: initialize

 public static function initialize(Jam_Meta $meta)
 {
     // Set database to connect to
     $meta->db(Kohana::TESTING);
     $meta->associations(array('test_post' => Jam::association('hasone', array('inverse_of' => 'test_author')), 'test_posts' => Jam::association('hasmany'), 'test_blogs_owned' => Jam::association('hasmany', array('foreign_model' => 'test_blog', 'foreign_key' => 'test_owner_id')), 'test_categories' => Jam::association('hasmany'), 'test_position' => Jam::association('belongsto'), 'permission' => Jam::association('belongsto', array('foreign_model' => 'test_position', 'foreign_key' => 'test_position_id'))));
     // Define fields
     $meta->fields(array('id' => Jam::field('primary'), 'name' => Jam::field('string'), 'password' => Jam::field('password'), 'email' => Jam::field('string')));
 }
开发者ID:Konro1,项目名称:pms,代码行数:8,代码来源:Author.php

示例10: set

 /**
  * Casts the returned value to a given type.
  *
  * @param   mixed   $value
  * @return  mixed
  */
 public function set(Jam_Validated $model, $value, $is_changed)
 {
     if (isset($this->cast)) {
         // Cast the value using the field type defined in 'cast'
         $value = Jam::field($this->cast)->set($value);
     }
     return $value;
 }
开发者ID:Konro1,项目名称:pms,代码行数:14,代码来源:Expression.php

示例11: initialize

 public static function initialize(Jam_Meta $meta)
 {
     // Set database to connect to
     $meta->db(Kohana::TESTING);
     $meta->associations(array('test_holder' => Jam::association('belongsto', array('polymorphic' => TRUE)), 'test_copyright' => Jam::association('hasone', array('dependent' => Jam_Association::ERASE)), 'test_copyrights' => Jam::association('hasmany', array('dependent' => Jam_Association::ERASE))));
     // Set fields
     $meta->fields(array('id' => Jam::field('primary'), 'file' => Jam::field('upload', array('delete_file' => TRUE))));
 }
开发者ID:Konro1,项目名称:pms,代码行数:8,代码来源:Image.php

示例12: initialize

 public static function initialize(Jam_Meta $meta)
 {
     // Set database to connect to
     $meta->db(Kohana::TESTING);
     $meta->associations(array('test_post' => Jam::association('belongsto', array('conditions' => array('where' => array('test_post._approved_by', 'IS', NULL)), 'counter_cache' => TRUE, 'touch' => 'updated')), 'test_blogs' => Jam::association('manytomany', array('join_table' => 'test_blogs_test_tags'))));
     $meta->behaviors(array('sluggable' => Jam::behavior('sluggable', array('uses_primary_key' => FALSE, 'unique' => TRUE, 'slug' => 'Model_Test_Tag::_slug'))));
     // Set fields
     $meta->fields(array('id' => Jam::field('primary'), 'name' => Jam::field('string')));
 }
开发者ID:Konro1,项目名称:pms,代码行数:9,代码来源:Tag.php

示例13: initialize

 public static function initialize(Jam_Meta $meta)
 {
     // Set database to connect to
     $meta->db(Kohana::TESTING);
     $meta->behaviors(array('nested' => Jam::behavior('nested')));
     $meta->associations(array('test_blog' => Jam::association('belongsto', array('inverse_of' => 'test_categories')), 'test_posts' => Jam::association('manytomany'), 'test_author' => Jam::association('belongsto')));
     // Define fields
     $meta->fields(array('id' => Jam::field('primary'), 'name' => Jam::field('string'), 'is_featured' => Jam::field('boolean')));
 }
开发者ID:Konro1,项目名称:pms,代码行数:9,代码来源:Category.php

示例14: initialize

 public static function initialize(Jam_Meta $meta)
 {
     // Set database to connect to
     $meta->db(Kohana::TESTING);
     $meta->associations(array('test_author' => Jam::association('belongsto')));
     // Set fields
     $meta->fields(array('id' => Jam::field('primary'), 'name' => Jam::field('string'), 'url' => Jam::field('string'), 'email' => Jam::field('string'), 'description' => Jam::field('string'), 'amount' => Jam::field('integer')));
     $meta->validator('name', array('present' => TRUE))->validator('name', 'email', 'url', array('count' => array('minimum' => 2)))->validator('email', array('format' => array('filter' => FILTER_VALIDATE_EMAIL)))->validator('url', array('format' => array('filter' => FILTER_VALIDATE_URL)))->validator('amount', array('numeric' => array('greater_than' => 10, 'less_than' => 100)))->validator('description', array('length' => array('between' => array(10, 1000))))->validator('name', array('format' => array('filter' => FILTER_VALIDATE_IP), 'if' => 'name_is_ip'))->validator('name', array('length' => array('minimum' => 2)));
     $meta->with_options(array('unless' => 'name_is_normal()'))->validator('name', array('format' => array('filter' => FILTER_VALIDATE_EMAIL)));
 }
开发者ID:Konro1,项目名称:pms,代码行数:10,代码来源:Element.php

示例15: initialize

 public static function initialize(Jam_Meta $meta)
 {
     // Set database to connect to
     $meta->db(Kohana::TESTING);
     $meta->name_key('file');
     $meta->behaviors(array('paranoid' => Jam::behavior('paranoid', array('field' => 'deleted')), 'sortable' => Jam::behavior('sortable', array('field' => 'position', 'scope' => 'group')), 'sluggable' => Jam::behavior('sluggable', array('auto_save' => TRUE)), 'tokenable' => Jam::behavior('tokenable', array('uppercase' => TRUE))));
     $meta->associations(array('test_holder' => Jam::association('belongsto', array('polymorphic' => 'test_holder_type'))));
     // Set fields
     $meta->fields(array('id' => Jam::field('primary'), 'file' => Jam::field('string'), 'group' => Jam::field('string')));
     $meta->validator('file', array('length' => array('minimum' => 4)));
 }
开发者ID:Konro1,项目名称:pms,代码行数:11,代码来源:Video.php


注:本文中的Jam::field方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。