4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC. All rights reserved. |
7 | This work is published under the GNU AGPLv3 license with some |
8 | permitted exceptions and without any warranty. For full license |
9 | and copyright information, see https://civicrm.org/licensing |
10 +--------------------------------------------------------------------+
13 namespace Civi\Api4\Generic
;
16 * Base class for DAO-based entities.
18 abstract class DAOEntity
extends AbstractEntity
{
21 * @param bool $checkPermissions
22 * @return DAOGetAction
24 public static function get($checkPermissions = TRUE) {
25 return (new DAOGetAction(static::class, __FUNCTION__
))
26 ->setCheckPermissions($checkPermissions);
30 * @param bool $checkPermissions
31 * @return DAOSaveAction
33 public static function save($checkPermissions = TRUE) {
34 return (new DAOSaveAction(static::class, __FUNCTION__
))
35 ->setCheckPermissions($checkPermissions);
39 * @param bool $checkPermissions
40 * @return DAOGetFieldsAction
42 public static function getFields($checkPermissions = TRUE) {
43 return (new DAOGetFieldsAction(static::class, __FUNCTION__
))
44 ->setCheckPermissions($checkPermissions);
48 * @param bool $checkPermissions
49 * @return DAOCreateAction
51 public static function create($checkPermissions = TRUE) {
52 return (new DAOCreateAction(static::class, __FUNCTION__
))
53 ->setCheckPermissions($checkPermissions);
57 * @param bool $checkPermissions
58 * @return DAOUpdateAction
60 public static function update($checkPermissions = TRUE) {
61 return (new DAOUpdateAction(static::class, __FUNCTION__
))
62 ->setCheckPermissions($checkPermissions);
66 * @param bool $checkPermissions
67 * @return DAODeleteAction
69 public static function delete($checkPermissions = TRUE) {
70 return (new DAODeleteAction(static::class, __FUNCTION__
))
71 ->setCheckPermissions($checkPermissions);
75 * @param bool $checkPermissions
76 * @return BasicReplaceAction
78 public static function replace($checkPermissions = TRUE) {
79 return (new BasicReplaceAction(static::class, __FUNCTION__
))
80 ->setCheckPermissions($checkPermissions);
86 protected static function getEntityTitle() {
87 $name = static::getEntityName();
88 $dao = \CRM_Core_DAO_AllCoreTables
::getFullName($name);
89 return $dao ?
$dao::getEntityTitle() : $name;
95 public static function getInfo() {
96 $info = parent
::getInfo();
97 $dao = \CRM_Core_DAO_AllCoreTables
::getFullName($info['name']);
99 $info['icon'] = $dao::$_icon;