3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
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 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
19 * Access Control EntityRole.
21 class CRM_ACL_BAO_EntityRole
extends CRM_ACL_DAO_EntityRole
{
22 public static $_entityTable = NULL;
29 public static function entityTable() {
30 if (!self
::$_entityTable) {
31 self
::$_entityTable = [
32 'civicrm_contact' => ts('Contact'),
33 'civicrm_group' => ts('Group'),
36 return self
::$_entityTable;
40 * @param array $params
42 * @return CRM_ACL_DAO_EntityRole
44 public static function create(&$params) {
45 $dao = new CRM_ACL_DAO_EntityRole();
46 $dao->copyValues($params);
52 * @param array $params
55 public static function retrieve(&$params, &$defaults) {
56 CRM_Core_DAO
::commonRetrieve('CRM_ACL_DAO_EntityRole', $params, $defaults);
60 * Update the is_active flag in the db.
63 * Id of the database record.
64 * @param bool $is_active
65 * Value we want to set the is_active field.
68 * true if we found and updated the object, else false
70 public static function setIsActive($id, $is_active) {
71 return CRM_Core_DAO
::setFieldValue('CRM_ACL_DAO_EntityRole', $id, 'is_active', $is_active);
75 * Delete Entity Role records.
77 * @param int $entityRoleId
78 * ID of the EntityRole record to be deleted.
81 public static function del($entityRoleId) {
82 $entityDAO = new CRM_ACL_DAO_EntityRole();
83 $entityDAO->id
= $entityRoleId;
84 $entityDAO->find(TRUE);