本文整理匯總了PHP中Subject::getSubject方法的典型用法代碼示例。如果您正苦於以下問題:PHP Subject::getSubject方法的具體用法?PHP Subject::getSubject怎麽用?PHP Subject::getSubject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Subject
的用法示例。
在下文中一共展示了Subject::getSubject方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: match
public function match(Subject $subject)
{
$em = $this->getEntityManager();
$query = $em->createQuery('Select IDENTITY(s.user)
From SubwayBuddyUserBundle:Subject s
WHERE s.subject = ?1
AND s.user != ?2');
$query->setParameter(1, $subject->getSubject());
$query->setParameter(2, $subject->getUser());
return $query->getResult();
}
示例2: Subject
$bool_str2 = $isBlocked2 ? "true" : "false";
printf("User is blocked: %s\n", $bool_str2);
unset($user);
unset($user2);
////////////////////////////
//Subject UNIT TESTS
////////////////////////////
printf("/////////////////////////////////\n");
printf("STARTING Subject UNIT TESTS\n");
printf("/////////////////////////////////\n");
//construct subject
$subject = new Subject();
//add subject
$subject->addSubject("Math");
//get subject
$subject_string = $subject->getSubject();
printf("Got Subject: %s\n", $subject_string);
//get AZSubjectArray
$orderedArray = $subject->getAZSubjects();
printf("Ordered Subjects: \n");
foreach ($orderedArray as $subject_val) {
printf("%s\n", $subject_val);
}
////////////////////////////
//Classes UNIT TESTS
////////////////////////////
printf("/////////////////////////////////\n");
printf("STARTING Classes UNIT TESTS\n");
printf("/////////////////////////////////\n");
//construct empty class
$class = new Classes();
示例3: getSubjectById
static function getSubjectById($subject_id)
{
//clear the result
$subject = '';
$connection = Database::getConnection();
$query = 'SELECT subject FROM subject WHERE id=' . $subject_id;
//echo $query;
//Run the query
$result_obj = $connection->query($query);
try {
//I COULD USE A FOR AND IT WOULD BE BETTER
//BUT IT DOESN'T WORK AND I HAVE NO TIME TO
//FIND THE PROBLEM :)
//SHOULD BE ONLY ONE RESULT
$i = 0;
while ($result = $result_obj->fetch_array(MYSQLI_ASSOC)) {
$subject = new Subject($result);
$i++;
}
//pass back the result
return $subject->getSubject();
} catch (Exception $e) {
$_SESSION['message'] = $e->getMessage();
//Not properly good for safety
}
}