GenCode - Allow overriding the short entity name
authorTim Otten <totten@civicrm.org>
Thu, 30 Dec 2021 03:25:21 +0000 (21:25 -0600)
committerTim Otten <totten@civicrm.org>
Thu, 13 Jan 2022 20:58:07 +0000 (12:58 -0800)
commit587261c312214bd2d3afca83134f1acee3977d74
treea91e81664c8c3766a0dc077a6a42003220ae53fe
parent57f357559ab66763c1ba1d51727402f334a655bf
GenCode - Allow overriding the short entity name

Before
------

The short entity-name must always be an exact match to the _last_ part of the class-name.

Ex: The class `CRM_Mailing_Event_BAO_Queue` has short entity-name of `Queue`.
This will cause a conflict if any other subsystem has a class ending in `Queue`
(eg `CRM_Contribute_BAO_Queue` or `CRM_Queue_Queue`).

After
-----

By default, the short entity-name matches the last part of the class-name.

But this can be overridden in `xml/schema/*`, eg

```xml
<table>
  <base>CRM/Mailing/Event</base>
  <class>Queue</class>
  <entity>MailingEventQueue</entity>
```

Comments
---------

To see that this change is generally safe (ie does not impact existing entity), I force-regenereated all DAOs

```
GENCODE_FORCE=1 ./bin/setup.sh -g
```

This produced no substantive change in existing DAOs -- because they do not have the `<entity>` tag.
CRM/Core/CodeGen/Specification.php
xml/templates/listAll.tpl