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


PHP grade_object::fetch_all_helper方法代码示例

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


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

示例1: test_fetch_all_helper

 public function test_fetch_all_helper()
 {
     // Simple ID lookup.
     $params = array('id' => $this->grade_items[0]->id);
     $items = grade_object::fetch_all_helper('grade_items', 'grade_item', $params);
     $this->assertCount(1, $items);
     $item = array_shift($items);
     $this->assertInstanceOf('grade_item', $item);
     $this->assertEquals($item->id, $this->grade_items[0]->id);
     // Various parameters lookup, multiple results.
     $params = array('courseid' => $this->course->id, 'categoryid' => $this->grade_categories[1]->id);
     $items = grade_object::fetch_all_helper('grade_items', 'grade_item', $params);
     $this->assertCount(2, $items);
     $expecteditems = array($this->grade_items[0]->id => true, $this->grade_items[1]->id => true);
     foreach ($items as $item) {
         $this->assertInstanceOf('grade_item', $item);
         $this->assertArrayHasKey($item->id, $expecteditems);
         unset($expecteditems[$item->id]);
     }
     // Text column lookup.
     $params = array('iteminfo' => $this->grade_items[2]->iteminfo);
     $items = grade_object::fetch_all_helper('grade_items', 'grade_item', $params);
     $this->assertCount(1, $items);
     $item = array_shift($items);
     $this->assertInstanceOf('grade_item', $item);
     $this->assertEquals($item->id, $this->grade_items[2]->id);
     // Lookup using non-existing columns.
     $params = array('doesnotexist' => 'ignoreme', 'id' => $this->grade_items[0]->id);
     $items = grade_object::fetch_all_helper('grade_items', 'grade_item', $params);
     $this->assertCount(1, $items);
     $item = array_shift($items);
     $this->assertInstanceOf('grade_item', $item);
     $this->assertEquals($item->id, $this->grade_items[0]->id);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:34,代码来源:grade_object_test.php

示例2: fetch_helper

 /**
  * Factory method - uses the parameters to retrieve matching instance from the DB.
  * @static final protected
  * @return mixed object instance or false if not found
  */
 protected static function fetch_helper($table, $classname, $params)
 {
     if ($instances = grade_object::fetch_all_helper($table, $classname, $params)) {
         if (count($instances) > 1) {
             // we should not tolerate any errors here - problems might appear later
             print_error('morethanonerecordinfetch', 'debug');
         }
         return reset($instances);
     } else {
         return false;
     }
 }
开发者ID:vuchannguyen,项目名称:web,代码行数:17,代码来源:grade_object.php

示例3: fetch_all

 /**
  * Finds and returns all grade_category instances based on params.
  *
  * @param array $params associative arrays varname=>value
  * @return array array of grade_category insatnces or false if none found.
  */
 public static function fetch_all($params)
 {
     return grade_object::fetch_all_helper('grade_categories', 'grade_category', $params);
 }
开发者ID:covex-nn,项目名称:moodle,代码行数:10,代码来源:grade_category.php

示例4: fetch_all

 /**
  * Finds and returns all grade_scale instances based on params.
  * @static
  *
  * @param array $params associative arrays varname=>value
  * @return array array of grade_scale insatnces or false if none found.
  */
 function fetch_all($params)
 {
     return grade_object::fetch_all_helper('scale', 'grade_scale', $params);
 }
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:11,代码来源:grade_scale.php

示例5: fetch_all

 /**
  * Finds and returns all grade_outcome instances based on params.
  * @static
  *
  * @param array $params associative arrays varname=>value
  * @return array array of grade_outcome insatnces or false if none found.
  */
 function fetch_all($params)
 {
     return grade_object::fetch_all_helper('grade_outcomes', 'grade_outcome', $params);
 }
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:11,代码来源:grade_outcome.php

示例6: fetch_all

 /**
  * Finds and returns all grade_item instances based on params.
  * @static
  *
  * @param array $params associative arrays varname=>value
  * @return array array of grade_item insatnces or false if none found.
  */
 function fetch_all($params)
 {
     return grade_object::fetch_all_helper('grade_items', 'grade_item', $params);
 }
开发者ID:r007,项目名称:PMoodle,代码行数:11,代码来源:grade_item.php

示例7: fetch_all

 /**
  * Finds and returns all grade_category instances based on params.
  *
  * @param array $params associative arrays varname=>value
  * @return array array of grade_category insatnces or false if none found.
  */
 public static function fetch_all($params)
 {
     if ($records = self::retrieve_record_set($params)) {
         return $records;
     }
     $records = grade_object::fetch_all_helper('grade_categories', 'grade_category', $params);
     self::set_record_set($params, $records);
     return $records;
 }
开发者ID:rushi963,项目名称:moodle,代码行数:15,代码来源:grade_category.php

示例8: fetch_helper

 /**
  * Factory method - uses the parameters to retrieve matching instance from the DB.
  * @static final protected
  * @return mixed object insatnce or false if not found
  */
 function fetch_helper($table, $classname, $params)
 {
     // we have to do use this hack because of the incomplete OOP implementation in PHP4 :-(
     // in PHP5 we could do it much better
     if ($instances = grade_object::fetch_all_helper($table, $classname, $params)) {
         if (count($instances) > 1) {
             // we should not tolerate any errors here - problems might appear later
             error('Found more than one record in fetch() !');
         }
         return reset($instances);
     } else {
         return false;
     }
 }
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:19,代码来源:grade_object.php


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