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