本文整理汇总了PHP中Requirements::updateRequirementAndPackage方法的典型用法代码示例。如果您正苦于以下问题:PHP Requirements::updateRequirementAndPackage方法的具体用法?PHP Requirements::updateRequirementAndPackage怎么用?PHP Requirements::updateRequirementAndPackage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Requirements
的用法示例。
在下文中一共展示了Requirements::updateRequirementAndPackage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateRequirementPackage
public function updateRequirementPackage($pack)
{
if (!$pack || !$pack->game_id || !$pack->requirement_root_package_id) {
return;
}
Module::query("UPDATE requirement_root_packages SET " . "game_id = '" . addslashes($pack->game_id) . "'" . ($pack->name ? ", name = '" . addslashes($pack->name) . "'" : "") . " WHERE requirement_root_package_id = '" . addslashes($pack->requirement_root_package_id) . "'");
$sql_currentAndPacks = Module::queryArray("SELECT * FROM requirement_and_packages WHERE requirement_root_package_id = '{$pack->requirement_root_package_id}'");
for ($i = 0; $i < count($sql_currentAndPacks); $i++) {
$matchingAndPack = null;
for ($j = 0; $pack->and_packages && $j < count($pack->and_packages); $j++) {
if ($sql_currentAndPacks[$i]->requirement_and_package_id == $pack->and_packages[$j]->requirement_and_package_id) {
$matchingAndPack = $pack->and_packages[$j];
//remove from array so I can just add all remaining later
array_splice($pack->and_packages, $j, 1);
$j--;
}
}
if ($matchingAndPack) {
$matchingAndPack->requirement_root_package_id = $pack->requirement_root_package_id;
$matchingAndPack->game_id = $pack->game_id;
Requirements::updateRequirementAndPackage($matchingAndPack);
} else {
Requirements::deleteRequirementAndPackage($sql_currentAndPacks[$i]->requirement_and_package_id);
}
}
for ($i = 0; $pack->and_packages && $i < count($pack->and_packages); $i++) {
$pack->and_packages[$i]->requirement_root_package_id = $pack->requirement_root_package_id;
$pack->and_packages[$i]->game_id = $pack->game_id;
Requirements::createRequirementAndPackage($pack->and_packages[$i]);
}
return Requirements::getRequirementPackage($pack->requirement_root_package_id);
}