Merge pull request #22992 from eileenmcnaughton/billingnot
[civicrm-core.git] / Civi / Api4 / Generic / Traits / ReadOnlyEntity.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 namespace Civi\Api4\Generic\Traits;
13
14 /**
15 * Trait for Entities not intended to be publicly writable.
16 */
17 trait ReadOnlyEntity {
18
19 /**
20 * Not intended to be used outside CiviCRM core code.
21 *
22 * @inheritDoc
23 * @internal
24 */
25 public static function save($checkPermissions = TRUE) {
26 return parent::save($checkPermissions);
27 }
28
29 /**
30 * Not intended to be used outside CiviCRM core code.
31 *
32 * @inheritDoc
33 * @internal
34 */
35 public static function create($checkPermissions = TRUE) {
36 return parent::create($checkPermissions);
37 }
38
39 /**
40 * Not intended to be used outside CiviCRM core code.
41 *
42 * @inheritDoc
43 * @internal
44 */
45 public static function update($checkPermissions = TRUE) {
46 return parent::update($checkPermissions);
47 }
48
49 /**
50 * Not intended to be used outside CiviCRM core code.
51 *
52 * @inheritDoc
53 * @internal
54 */
55 public static function delete($checkPermissions = TRUE) {
56 return parent::delete($checkPermissions);
57 }
58
59 /**
60 * Not intended to be used outside CiviCRM core code.
61 *
62 * @inheritDoc
63 * @internal
64 */
65 public static function replace($checkPermissions = TRUE) {
66 return parent::replace($checkPermissions);
67 }
68
69 /**
70 * @return array
71 */
72 public static function permissions() {
73 $permissions = parent::permissions();
74 $permissions['create'] = $permissions['update'] = $permissions['delete'] = \CRM_Core_Permission::ALWAYS_DENY_PERMISSION;
75 return $permissions;
76 }
77
78 }