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