@@ 1365-1376 (lines=12) @@ | ||
1362 | * @param int $itemId The item ID |
|
1363 | * @return array The beneficiries. Otherwise return false |
|
1364 | */ |
|
1365 | public function getItemBeneficiaries($itemId) |
|
1366 | { |
|
1367 | $beneficiaryTable = Database::get_main_table(self::TABLE_ITEM_BENEFICIARY); |
|
1368 | ||
1369 | return Database::select( |
|
1370 | '*', |
|
1371 | $beneficiaryTable, |
|
1372 | ['where' => [ |
|
1373 | 'item_id = ?' => intval($itemId) |
|
1374 | ]] |
|
1375 | ); |
|
1376 | } |
|
1377 | ||
1378 | /** |
|
1379 | * Delete a item with its beneficiaries |
|
@@ 1437-1445 (lines=9) @@ | ||
1434 | * @param int $itemId The user ID |
|
1435 | * @return int The number of affected rows. Otherwise return false |
|
1436 | */ |
|
1437 | public function deleteItemBeneficiaries($itemId) |
|
1438 | { |
|
1439 | $beneficiaryTable = Database::get_main_table(BuyCoursesPlugin::TABLE_ITEM_BENEFICIARY); |
|
1440 | ||
1441 | return Database::delete( |
|
1442 | $beneficiaryTable, |
|
1443 | ['item_id = ?' => intval($itemId)] |
|
1444 | ); |
|
1445 | } |
|
1446 | ||
1447 | /** |
|
1448 | * Register the beneficiaries users with the sale of item |