本文整理汇总了PHP中Department::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Department::getId方法的具体用法?PHP Department::getId怎么用?PHP Department::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Department
的用法示例。
在下文中一共展示了Department::getId方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testFind
function testFind()
{
//Arrange
$name = "Math";
$id = 1;
$test_department = new Department($name, $id);
$test_department->save();
$name2 = "Business";
$id2 = 2;
$test_department2 = new Department($name2, $id2);
$test_department2->save();
//Act
$id = $test_department->getId();
$result = Department::find($id);
//Assert
$this->assertEquals($test_department, $result);
}
示例2: getFacultyByDepartmentAssoc
/**
* Returns an array of Faculty objects for the given department.
* @param Department $department
* @return Array List of faculty for requested department.
*/
public static function getFacultyByDepartmentAssoc(Department $department)
{
$sql = "SELECT intern_faculty.* FROM intern_faculty JOIN intern_faculty_department ON intern_faculty.id = intern_faculty_department.faculty_id WHERE intern_faculty_department.department_id = {$department->getId()} ORDER BY last_name ASC";
$result = \PHPWS_DB::getAll($sql);
return $result;
}
示例3: addInstanceToPool
/**
* Adds an object to the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases -- especially when you override doSelect*()
* methods in your stub classes -- you may need to explicitly add objects
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param Department $value A Department object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool(Department $obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getId();
}
// if key === null
self::$instances[$key] = $obj;
}
}
示例4: setDepartment
/**
* Declares an association between this object and a Department object.
*
* @param Department $v
* @return Employee The current object (for fluent API support)
* @throws PropelException
*/
public function setDepartment(Department $v = null)
{
if ($v === null) {
$this->setDepartmentId(NULL);
} else {
$this->setDepartmentId($v->getId());
}
$this->aDepartment = $v;
// Add binding for other direction of this n:n relationship.
// If this object has already been added to the Department object, it will not be re-added.
if ($v !== null) {
$v->addEmployee($this);
}
return $this;
}
示例5: Department
function test_getCourses()
{
//Arrange
$test_department = new Department("Biology", "346 Stupid Avenue");
$test_department->save();
$name = "History 0001";
$code = "HS001";
$test_course = new Course($name, $code, $test_department->getId());
$test_course->save();
$name2 = "Dogs 101";
$code2 = "DW101";
$test_course2 = new Course($name2, $code2, $test_department->getId());
$test_course2->save();
//Act
$result = $test_department->getCourses();
//Assert
$this->assertEquals([$test_course, $test_course2], $result);
}
示例6: Department
function test_updateCompleted()
{
//Arrange
$test_department = new Department("Biology", "346 Stupid Avenue");
$test_department->save();
$test_student = new Student("Shmuel Irving-Jones", "2015-08-25", $test_department->getId());
$test_student->save();
$test_course = new Course("High Times", "CHEM420", $test_department->getId());
$test_course->save();
$test_course2 = new Course("Gavanese Jamelan", "MUSC69", $test_department->getId());
$test_course2->save();
$test_student->addCourse($test_course);
$test_student->addCourse($test_course2);
//Act
$test_student->updateCompleted($test_course->getId());
//Assert
$this->assertEquals(true, $test_student->getCompleted($test_course->getId()));
}
示例7: Department
function test_getStudents()
{
//Arrange
$test_department = new Department("Biology", "346 Stupid Avenue");
$test_department->save();
$test_course = new Course("Fundamentals of Human Anatomy", "SEXY101", $test_department->getId());
$test_course->save();
$test_course2 = new Course("Organic Chemistry of Cannabinoids", "CHEM420", $test_department->getId());
$test_course2->save();
$test_student = new Student("Sarah", "2000-04-01", $test_department->getId());
$test_student->save();
$test_student2 = new Student("JC", "0000-12-25", $test_department->getId());
$test_student2->save();
//Act
$test_course->addStudent($test_student);
$test_course->addStudent($test_student2);
$test_course2->addStudent($test_student);
//Assert
$this->assertEquals($test_course->getStudents(), [$test_student, $test_student2]);
}