@@ 1390-1401 (lines=12) @@ | ||
1387 | * @param int $itemId The item ID |
|
1388 | * @return array The beneficiries. Otherwise return false |
|
1389 | */ |
|
1390 | public function getItemBeneficiaries($itemId) |
|
1391 | { |
|
1392 | $beneficiaryTable = Database::get_main_table(self::TABLE_ITEM_BENEFICIARY); |
|
1393 | ||
1394 | return Database::select( |
|
1395 | '*', |
|
1396 | $beneficiaryTable, |
|
1397 | ['where' => [ |
|
1398 | 'item_id = ?' => intval($itemId) |
|
1399 | ]] |
|
1400 | ); |
|
1401 | } |
|
1402 | ||
1403 | /** |
|
1404 | * Delete a item with its beneficiaries |
|
@@ 1462-1470 (lines=9) @@ | ||
1459 | * @param int $itemId The user ID |
|
1460 | * @return int The number of affected rows. Otherwise return false |
|
1461 | */ |
|
1462 | public function deleteItemBeneficiaries($itemId) |
|
1463 | { |
|
1464 | $beneficiaryTable = Database::get_main_table(BuyCoursesPlugin::TABLE_ITEM_BENEFICIARY); |
|
1465 | ||
1466 | return Database::delete( |
|
1467 | $beneficiaryTable, |
|
1468 | ['item_id = ?' => intval($itemId)] |
|
1469 | ); |
|
1470 | } |
|
1471 | ||
1472 | /** |
|
1473 | * Register the beneficiaries users with the sale of item |