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