Merge pull request #16138 from eileenmcnaughton/static
[civicrm-core.git] / CRM / Member / BAO / MembershipBlock.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
10 */
11
12 /**
13 *
14 * @package CRM
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
16 * $Id$
17 *
18 */
19 class CRM_Member_BAO_MembershipBlock extends CRM_Member_DAO_MembershipBlock {
20
21 /**
22 * Class constructor.
23 */
24 public function __construct() {
25 parent::__construct();
26 }
27
28 /**
29 * Add the membership Blocks.
30 *
31 * @param array $params
32 * Reference array contains the values submitted by the form.
33 *
34 *
35 * @return object
36 */
37 public static function create(&$params) {
38 $hook = empty($params['id']) ? 'create' : 'edit';
39 CRM_Utils_Hook::pre($hook, 'MembershipBlock', CRM_Utils_Array::value('id', $params), $params);
40 $dao = new CRM_Member_DAO_MembershipBlock();
41 $dao->copyValues($params, TRUE);
42 $dao->id = CRM_Utils_Array::value('id', $params);
43 $dao->save();
44 CRM_Utils_Hook::post($hook, 'MembershipBlock', $dao->id, $dao);
45 return $dao;
46 }
47
48 /**
49 * Delete membership Blocks.
50 *
51 * @param int $id
52 *
53 * @return bool
54 */
55 public static function del($id) {
56 $dao = new CRM_Member_DAO_MembershipBlock();
57 $dao->id = $id;
58 $result = FALSE;
59 if ($dao->find(TRUE)) {
60 $dao->delete();
61 $result = TRUE;
62 }
63 return $result;
64 }
65
66 }