當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Course::getCourseId方法代碼示例

本文整理匯總了PHP中Course::getCourseId方法的典型用法代碼示例。如果您正苦於以下問題:PHP Course::getCourseId方法的具體用法?PHP Course::getCourseId怎麽用?PHP Course::getCourseId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Course的用法示例。


在下文中一共展示了Course::getCourseId方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: create

 /**
  * Creates a new entry.
  * @param User $creator The creator of the entry.
  * @param type $title The title of the entry.
  * @param type $description The entry description.
  * @return Entry
  * @throws Exception
  */
 public static function create(User $creator, Course $course, $title, $description)
 {
     // Insert it into the database
     $query = Database::connection()->prepare('INSERT INTO entry (courseid, created_at, created_by, display_at, title, description)' . ' VALUES (?, ?, ?, ?, ?, ?)');
     $query->bindValue(1, $course->getCourseId(), PDO::PARAM_INT);
     $query->bindValue(2, time(), PDO::PARAM_INT);
     $query->bindValue(3, $creator->getUserId(), PDO::PARAM_INT);
     $query->bindValue(4, time(), PDO::PARAM_INT);
     $query->bindValue(5, $title, PDO::PARAM_STR);
     $query->bindValue(6, $description, PDO::PARAM_STR);
     if (!$query->execute()) {
         throw new Exception('Entry could not be created in the database.');
     }
     // Get the course from the last insert id
     $entry = self::fromId(Database::connection()->lastInsertId());
     // Sync the course
     $entry->changed();
     // Return the course
     return $entry;
 }
開發者ID:brandonfrancis,項目名稱:scsapi,代碼行數:28,代碼來源:entry.php

示例2: course

 /**
  * Adds a course to the sync queue.
  * @param Course $course The course to add.
  */
 public static function course(Course $course)
 {
     self::$coursesToSync[$course->getCourseId()] = $course;
 }
開發者ID:brandonfrancis,項目名稱:scsapi,代碼行數:8,代碼來源:sync.php

示例3: testFind

 function testFind()
 {
     //arrange
     $course_name = "Chemistry";
     $course_id = 1;
     $course_number = "1000";
     $test_course = new Course($course_name, $course_number, $course_id);
     $test_course->save();
     $course_name2 = "Underwater Basketweaving";
     $course_id2 = 2;
     $course_number2 = "2531";
     $test_course2 = new Course($course_name2, $course_number2, $course_id2);
     $test_course2->save();
     //act
     $result = Course::find($test_course->getCourseId());
     //assert
     $this->assertEquals($test_course, $result);
 }
開發者ID:nathanhwyoung,項目名稱:registrar,代碼行數:18,代碼來源:CourseTest.php


注:本文中的Course::getCourseId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。