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


PHP ActiveRecord::has_field_for_class方法代码示例

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


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

示例1: testActiveRecordFunctioning

 public function testActiveRecordFunctioning()
 {
     //OK FUNZIONA
     $this->assertTrue(ActiveRecord::has_table_for_class("Simple2"));
     $this->assertTrue(ActiveRecord::get_table_for_class("Simple2"), "simple2_table");
     //NON FUNZIONA
     $this->assertEqual(count(ActiveRecord::getPrimaryKeyFields("Simple2")), 1);
     $pk_fields = ActiveRecord::getPrimaryKeyFields("Simple2");
     $this->assertEqual($pk_fields[0], "id");
     //NON FUNZIONA
     $this->assertTrue(ActiveRecord::has_field_for_class("Simple2", "id"));
     $this->assertTrue(ActiveRecord::has_field_for_class("Simple2", "nome"));
     $this->assertTrue(ActiveRecord::has_field_for_class("Simple2", "livello"));
     $this->assertTrue(ActiveRecord::has_field_for_class("Simple2", "properties"));
     $this->assertTrue(ActiveRecord::has_field_for_class("Simple2", "working"));
 }
开发者ID:mbcraft,项目名称:frozen,代码行数:16,代码来源:active_record_test.php

示例2: testCreateSaveDelete

 public function testCreateSaveDelete()
 {
     $this->assertTrue(ActiveRecord::has_field_for_class("Simple", "id"));
     $peer = new SimplePeer();
     $do = $peer->new_do();
     $do->id = 1;
     $do->nome = "Paolino Paperino";
     $do->livello = 16;
     $peer = new SimplePeer();
     $objects = $peer->find_all();
     $this->assertEqual(count($objects), 0);
     $peer->save($do);
     $objects = $peer->find_all();
     $this->assertEqual(count($objects), 1);
     $ob = $objects[0];
     $this->assertEqual($ob->id, 1);
     $this->assertEqual($ob->nome, "Paolino Paperino");
     $this->assertEqual($ob->livello, 16);
     $peer->delete_by_id(1);
     $objects = $peer->find_all();
     $this->assertEqual(count($objects), 0);
 }
开发者ID:mbcraft,项目名称:frozen,代码行数:22,代码来源:simple_do_test.php

示例3: __find_all_by__

 public function __find_all_by__($method, $args)
 {
     $original_method = $method;
     $method = str_replace("find_all_by_", "", $method);
     $field_list = explode("_AND_", $method);
     if (count($args) != count($field_list)) {
         Log::error(__METHOD__, "Il numero dei campi non corrisponde : {$original_method}");
     }
     $table = $this->__getMyTable();
     $raw_class_name = $this->__getRawClassName();
     $ss = DB::newSelect($table);
     $i = 0;
     foreach ($field_list as $field) {
         if (!ActiveRecord::has_field_for_class($raw_class_name, $field)) {
             throw new Exception("Il campo '{$field}' non e' presente nella tabella '{$table}', raw class name " . $raw_class_name . " :" . ActiveRecord::print_fields_for_class($raw_class_name) . " - " . ActiveRecord::print_tables());
         }
         $ss->addConditionEquals($field, $args[$i]);
         $i++;
     }
     return $this->__load_into_objects($ss);
 }
开发者ID:mbcraft,项目名称:frozen,代码行数:21,代码来源:AbstractPeer.class.php


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