本文整理汇总了PHP中Relationship::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Relationship::find方法的具体用法?PHP Relationship::find怎么用?PHP Relationship::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Relationship
的用法示例。
在下文中一共展示了Relationship::find方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: scopeGetRelationshipById
public function scopeGetRelationshipById($query, $relationship_id)
{
$results = Relationship::find($relationship_id);
if (empty($results)) {
$results = array();
}
return $results;
}
示例2: get_vle_api
/**
* Get the VLE API that is in effect for the given module and academic year
* either from the module itself or from existing relationships
* @param integer $idMod ID of the module
* @param string $session Calendar year in the form YYYY/YY (e.g. 2012/13)
* @param array $vle_api_cache List of chached API references
* @param mysqli $db DB link
* @return string Name of the VLE API that is in effect
*/
public static function get_vle_api($idMod, $session, &$vle_api_cache, $db)
{
if (!isset($vle_api_cache[$idMod][$session])) {
// Are there any existing relationships for the module in this session?
$rels = Relationship::find($db, $idMod, $session, -1, '', 1);
if ($rels !== false and count($rels) > 0) {
$vle_api = $rels[0]->get_vle_api();
$map_level = $rels[0]->get_map_level();
} else {
// No existing relationships. Use VLE API as defined in the module
$stmt = $db->prepare("SELECT vle_api, map_level FROM modules WHERE id = ? LIMIT 1");
$stmt->bind_param('s', $idMod);
$stmt->execute();
$stmt->bind_result($vle_api, $map_level);
$stmt->fetch();
$stmt->close();
}
$vle_api_data = array('api' => $vle_api, 'level' => $map_level);
$vle_api_cache[$idMod][$session] = $vle_api_data;
} else {
$vle_api_data = $vle_api_cache[$idMod][$session];
}
return $vle_api_data;
}