Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renamed Mailing Component entity #12728

Merged
merged 3 commits into from
Sep 25, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CRM/Core/DAO/AllCoreTables.data.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@
'class' => 'CRM_Batch_DAO_EntityBatch',
'table' => 'civicrm_entity_batch',
],
'CRM_Mailing_DAO_Component' => [
'name' => 'Component',
'class' => 'CRM_Mailing_DAO_Component',
'CRM_Mailing_DAO_MailingComponent' => [
'name' => 'MailingComponent',
'class' => 'CRM_Mailing_DAO_MailingComponent',
'table' => 'civicrm_mailing_component',
],
'CRM_Mailing_DAO_MailingAB' => [
Expand Down
3 changes: 2 additions & 1 deletion CRM/Core/DAO/Component.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Generated from xml/schema/CRM/Core/Component.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:14ca0040d5a5656fd5dd91ad60a8ac89)
* (GenCodeChecksum:d0152fb407a743b3e15fd20c35f41c67)
*/

/**
Expand Down Expand Up @@ -69,6 +69,7 @@ public static function &fields() {
'id' => [
'name' => 'id',
'type' => CRM_Utils_Type::T_INT,
'title' => ts('Component ID'),
'description' => 'Component ID',
'required' => TRUE,
'table_name' => 'civicrm_component',
Expand Down
8 changes: 4 additions & 4 deletions CRM/Mailing/BAO/Component.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2018
*/
class CRM_Mailing_BAO_Component extends CRM_Mailing_DAO_Component {
class CRM_Mailing_BAO_Component extends CRM_Mailing_DAO_MailingComponent {

/**
* Class constructor.
Expand All @@ -50,7 +50,7 @@ public function __construct() {
* @return CRM_Core_BAO_LocationType.
*/
public static function retrieve(&$params, &$defaults) {
$component = new CRM_Mailing_DAO_Component();
$component = new CRM_Mailing_BAO_Component();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we put the new DAO here - given the BAO needs renaming too but perhaps in a later iteration?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. @pradpnayak can you update?

$component->copyValues($params);
if ($component->find(TRUE)) {
CRM_Core_DAO::storeValues($component, $defaults);
Expand All @@ -71,7 +71,7 @@ public static function retrieve(&$params, &$defaults) {
* true if we found and updated the object, else false
*/
public static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_Mailing_DAO_Component', $id, 'is_active', $is_active);
return CRM_Core_DAO::setFieldValue('CRM_Mailing_BAO_Component', $id, 'is_active', $is_active);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. @pradpnayak can you update?

}

/**
Expand All @@ -86,7 +86,7 @@ public static function setIsActive($id, $is_active) {
*/
public static function add(&$params, $ids = array()) {
$id = CRM_Utils_Array::value('id', $params, CRM_Utils_Array::value('id', $ids));
$component = new CRM_Mailing_DAO_Component();
$component = new CRM_Mailing_BAO_Component();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

if ($id) {
$component->id = $id;
$component->find(TRUE);
Expand Down
12 changes: 6 additions & 6 deletions CRM/Mailing/DAO/Mailing.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Generated from xml/schema/CRM/Mailing/Mailing.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:3e332257744be5cf9d7a2545f69f67eb)
* (GenCodeChecksum:3e943186d58d8e39d9765ce22d85ac79)
*/

/**
Expand Down Expand Up @@ -401,7 +401,7 @@ public static function &fields() {
'entity' => 'Mailing',
'bao' => 'CRM_Mailing_BAO_Mailing',
'localizable' => 0,
'FKClassName' => 'CRM_Mailing_DAO_Component',
'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
],
'footer_id' => [
'name' => 'footer_id',
Expand All @@ -412,7 +412,7 @@ public static function &fields() {
'entity' => 'Mailing',
'bao' => 'CRM_Mailing_BAO_Mailing',
'localizable' => 0,
'FKClassName' => 'CRM_Mailing_DAO_Component',
'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
],
'reply_id' => [
'name' => 'reply_id',
Expand All @@ -423,7 +423,7 @@ public static function &fields() {
'entity' => 'Mailing',
'bao' => 'CRM_Mailing_BAO_Mailing',
'localizable' => 0,
'FKClassName' => 'CRM_Mailing_DAO_Component',
'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
],
'unsubscribe_id' => [
'name' => 'unsubscribe_id',
Expand All @@ -434,7 +434,7 @@ public static function &fields() {
'entity' => 'Mailing',
'bao' => 'CRM_Mailing_BAO_Mailing',
'localizable' => 0,
'FKClassName' => 'CRM_Mailing_DAO_Component',
'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
],
'resubscribe_id' => [
'name' => 'resubscribe_id',
Expand All @@ -454,7 +454,7 @@ public static function &fields() {
'entity' => 'Mailing',
'bao' => 'CRM_Mailing_BAO_Mailing',
'localizable' => 0,
'FKClassName' => 'CRM_Mailing_DAO_Component',
'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
],
'name' => [
'name' => 'name',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2018
*
* Generated from xml/schema/CRM/Mailing/Component.xml
* Generated from xml/schema/CRM/Mailing/MailingComponent.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:33742feaa53eaba2c4a543c4e5c673ab)
* (GenCodeChecksum:08753305769bb8ac8d2824081322af92)
*/

/**
* Database access object for the Component entity.
* Database access object for the MailingComponent entity.
*/
class CRM_Mailing_DAO_Component extends CRM_Core_DAO {
class CRM_Mailing_DAO_MailingComponent extends CRM_Core_DAO {

/**
* Static instance to hold the table name.
Expand Down Expand Up @@ -102,8 +102,8 @@ public static function &fields() {
'title' => ts('Mailing Component ID'),
'required' => TRUE,
'table_name' => 'civicrm_mailing_component',
'entity' => 'Component',
'bao' => 'CRM_Mailing_BAO_Component',
'entity' => 'MailingComponent',
'bao' => 'CRM_Mailing_DAO_MailingComponent',
'localizable' => 0,
],
'name' => [
Expand All @@ -114,8 +114,8 @@ public static function &fields() {
'maxlength' => 64,
'size' => CRM_Utils_Type::BIG,
'table_name' => 'civicrm_mailing_component',
'entity' => 'Component',
'bao' => 'CRM_Mailing_BAO_Component',
'entity' => 'MailingComponent',
'bao' => 'CRM_Mailing_DAO_MailingComponent',
'localizable' => 0,
],
'component_type' => [
Expand All @@ -126,8 +126,8 @@ public static function &fields() {
'maxlength' => 12,
'size' => CRM_Utils_Type::TWELVE,
'table_name' => 'civicrm_mailing_component',
'entity' => 'Component',
'bao' => 'CRM_Mailing_BAO_Component',
'entity' => 'MailingComponent',
'bao' => 'CRM_Mailing_DAO_MailingComponent',
'localizable' => 0,
'html' => [
'type' => 'Select',
Expand All @@ -143,8 +143,8 @@ public static function &fields() {
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
'table_name' => 'civicrm_mailing_component',
'entity' => 'Component',
'bao' => 'CRM_Mailing_BAO_Component',
'entity' => 'MailingComponent',
'bao' => 'CRM_Mailing_DAO_MailingComponent',
'localizable' => 0,
],
'body_html' => [
Expand All @@ -155,8 +155,8 @@ public static function &fields() {
'rows' => 8,
'cols' => 80,
'table_name' => 'civicrm_mailing_component',
'entity' => 'Component',
'bao' => 'CRM_Mailing_BAO_Component',
'entity' => 'MailingComponent',
'bao' => 'CRM_Mailing_DAO_MailingComponent',
'localizable' => 0,
'html' => [
'type' => 'TextArea',
Expand All @@ -170,8 +170,8 @@ public static function &fields() {
'rows' => 8,
'cols' => 80,
'table_name' => 'civicrm_mailing_component',
'entity' => 'Component',
'bao' => 'CRM_Mailing_BAO_Component',
'entity' => 'MailingComponent',
'bao' => 'CRM_Mailing_DAO_MailingComponent',
'localizable' => 0,
'html' => [
'type' => 'TextArea',
Expand All @@ -184,8 +184,8 @@ public static function &fields() {
'description' => 'Is this the default component for this component_type?',
'default' => '0',
'table_name' => 'civicrm_mailing_component',
'entity' => 'Component',
'bao' => 'CRM_Mailing_BAO_Component',
'entity' => 'MailingComponent',
'bao' => 'CRM_Mailing_DAO_MailingComponent',
'localizable' => 0,
],
'is_active' => [
Expand All @@ -194,8 +194,8 @@ public static function &fields() {
'title' => ts('Mailing Component Is Active?'),
'description' => 'Is this property active?',
'table_name' => 'civicrm_mailing_component',
'entity' => 'Component',
'bao' => 'CRM_Mailing_BAO_Component',
'entity' => 'MailingComponent',
'bao' => 'CRM_Mailing_DAO_MailingComponent',
'localizable' => 0,
],
];
Expand Down
10 changes: 5 additions & 5 deletions CRM/Mailing/Form/Component.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,24 +62,24 @@ public function buildQuickForm() {
$this->applyFilter(array('name', 'subject', 'body_html'), 'trim');

$this->add('text', 'name', ts('Name'),
CRM_Core_DAO::getAttribute('CRM_Mailing_DAO_Component', 'name'), TRUE
CRM_Core_DAO::getAttribute('CRM_Mailing_BAO_Component', 'name'), TRUE
);
$this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array(
'CRM_Mailing_DAO_Component',
'CRM_Mailing_BAO_Component',
$this->_id,
));

$this->add('select', 'component_type', ts('Component Type'), CRM_Core_SelectValues::mailingComponents());

$this->add('text', 'subject', ts('Subject'),
CRM_Core_DAO::getAttribute('CRM_Mailing_DAO_Component', 'subject'),
CRM_Core_DAO::getAttribute('CRM_Mailing_BAO_Component', 'subject'),
TRUE
);
$this->add('textarea', 'body_text', ts('Body - TEXT Format'),
CRM_Core_DAO::getAttribute('CRM_Mailing_DAO_Component', 'body_text')
CRM_Core_DAO::getAttribute('CRM_Mailing_BAO_Component', 'body_text')
);
$this->add('textarea', 'body_html', ts('Body - HTML Format'),
CRM_Core_DAO::getAttribute('CRM_Mailing_DAO_Component', 'body_html')
CRM_Core_DAO::getAttribute('CRM_Mailing_BAO_Component', 'body_html')
);

$this->addYesNo('is_default', ts('Default?'));
Expand Down
4 changes: 2 additions & 2 deletions CRM/Mailing/PseudoConstant.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,13 @@ public static function &component($type = NULL) {
}
if (!$type) {
self::$component[$name] = NULL;
CRM_Core_PseudoConstant::populate(self::$component[$name], 'CRM_Mailing_DAO_Component');
CRM_Core_PseudoConstant::populate(self::$component[$name], 'CRM_Mailing_BAO_Component');
}
else {
// we need to add an additional filter for $type
self::$component[$name] = array();

$object = new CRM_Mailing_DAO_Component();
$object = new CRM_Mailing_BAO_Component();
$object->component_type = $type;
$object->selectAdd();
$object->selectAdd("id, name");
Expand Down
2 changes: 1 addition & 1 deletion api/v3/MailingComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* API result array.
*/
function civicrm_api3_mailing_component_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Component');
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'MailingComponent');
}


Expand Down
4 changes: 0 additions & 4 deletions api/v3/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,6 @@ function _civicrm_api3_get_DAO($name) {
if ($name == 'MailingRecipients') {
return 'CRM_Mailing_DAO_Recipients';
}
// FIXME: DAO should be renamed CRM_Mailing_DAO_MailingComponent
if ($name == 'MailingComponent') {
return 'CRM_Mailing_DAO_Component';
}
// FIXME: DAO should be renamed CRM_ACL_DAO_AclRole
if ($name == 'AclRole') {
return 'CRM_ACL_DAO_EntityRole';
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Core/PseudoConstantTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@ public function testOptionValues() {
'sample' => $campaign_name,
),
),
'CRM_Mailing_DAO_Component' => array(
'CRM_Mailing_DAO_MailingComponent' => array(
array(
'fieldName' => 'component_type',
'sample' => 'Header',
Expand Down
1 change: 0 additions & 1 deletion tests/phpunit/api/v3/SyntaxConformanceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,6 @@ public function testCustomDataGet($entityName) {
$this->createLoggedInUser();// so subsidiary activities are created

$entitiesWithNamingIssues = [
'MailingComponent' => 'Component',
'SmsProvider' => 'Provider',
'AclRole' => 'EntityRole',
'MailingEventQueue' => 'Queue',
Expand Down
1 change: 1 addition & 0 deletions xml/schema/Core/Component.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<add>2.0</add>
<field>
<name>id</name>
<title>Component ID</title>
<type>int unsigned</type>
<required>true</required>
<comment>Component ID</comment>
Expand Down
2 changes: 1 addition & 1 deletion xml/schema/Mailing/Component.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<table>
<base>CRM/Mailing</base>
<class>Component</class>
<class>MailingComponent</class>
<name>civicrm_mailing_component</name>
<comment>Stores information about the mailing components (header/footer).</comment>
<field>
Expand Down