From: Pradeep Nayak Date: Fri, 24 Aug 2018 13:29:39 +0000 (+0100) Subject: Renamed Mailing Component entity X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=807f8008a7ee92490dae941b35fdd9c1bcb3ab69;p=civicrm-core.git Renamed Mailing Component entity --- diff --git a/CRM/Core/DAO/AllCoreTables.data.php b/CRM/Core/DAO/AllCoreTables.data.php index 4f25998aa3..e42e08bf4e 100644 --- a/CRM/Core/DAO/AllCoreTables.data.php +++ b/CRM/Core/DAO/AllCoreTables.data.php @@ -122,9 +122,9 @@ return [ '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' => [ diff --git a/CRM/Mailing/BAO/Component.php b/CRM/Mailing/BAO/Component.php index 6840e3edee..77d7f85576 100644 --- a/CRM/Mailing/BAO/Component.php +++ b/CRM/Mailing/BAO/Component.php @@ -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. @@ -50,7 +50,7 @@ class CRM_Mailing_BAO_Component extends CRM_Mailing_DAO_Component { * @return CRM_Core_BAO_LocationType. */ public static function retrieve(&$params, &$defaults) { - $component = new CRM_Mailing_DAO_Component(); + $component = new CRM_Mailing_BAO_Component(); $component->copyValues($params); if ($component->find(TRUE)) { CRM_Core_DAO::storeValues($component, $defaults); @@ -71,7 +71,7 @@ class CRM_Mailing_BAO_Component extends CRM_Mailing_DAO_Component { * 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); } /** @@ -86,7 +86,7 @@ class CRM_Mailing_BAO_Component extends CRM_Mailing_DAO_Component { */ 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(); if ($id) { $component->id = $id; $component->find(TRUE); diff --git a/CRM/Mailing/DAO/Mailing.php b/CRM/Mailing/DAO/Mailing.php index 286256a503..9df37c518b 100644 --- a/CRM/Mailing/DAO/Mailing.php +++ b/CRM/Mailing/DAO/Mailing.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Mailing/Mailing.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:3e332257744be5cf9d7a2545f69f67eb) + * (GenCodeChecksum:3e943186d58d8e39d9765ce22d85ac79) */ /** @@ -401,7 +401,7 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO { 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, - 'FKClassName' => 'CRM_Mailing_DAO_Component', + 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent', ], 'footer_id' => [ 'name' => 'footer_id', @@ -412,7 +412,7 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO { 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, - 'FKClassName' => 'CRM_Mailing_DAO_Component', + 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent', ], 'reply_id' => [ 'name' => 'reply_id', @@ -423,7 +423,7 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO { 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, - 'FKClassName' => 'CRM_Mailing_DAO_Component', + 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent', ], 'unsubscribe_id' => [ 'name' => 'unsubscribe_id', @@ -434,7 +434,7 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO { 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, - 'FKClassName' => 'CRM_Mailing_DAO_Component', + 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent', ], 'resubscribe_id' => [ 'name' => 'resubscribe_id', @@ -454,7 +454,7 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO { 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, - 'FKClassName' => 'CRM_Mailing_DAO_Component', + 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent', ], 'name' => [ 'name' => 'name', diff --git a/CRM/Mailing/DAO/Component.php b/CRM/Mailing/DAO/MailingComponent.php similarity index 86% rename from CRM/Mailing/DAO/Component.php rename to CRM/Mailing/DAO/MailingComponent.php index 38aef9f12a..b6ad32fe56 100644 --- a/CRM/Mailing/DAO/Component.php +++ b/CRM/Mailing/DAO/MailingComponent.php @@ -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. @@ -102,8 +102,8 @@ class CRM_Mailing_DAO_Component extends CRM_Core_DAO { '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' => [ @@ -114,8 +114,8 @@ class CRM_Mailing_DAO_Component extends CRM_Core_DAO { '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' => [ @@ -126,8 +126,8 @@ class CRM_Mailing_DAO_Component extends CRM_Core_DAO { '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', @@ -143,8 +143,8 @@ class CRM_Mailing_DAO_Component extends CRM_Core_DAO { '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' => [ @@ -155,8 +155,8 @@ class CRM_Mailing_DAO_Component extends CRM_Core_DAO { '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', @@ -170,8 +170,8 @@ class CRM_Mailing_DAO_Component extends CRM_Core_DAO { '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', @@ -184,8 +184,8 @@ class CRM_Mailing_DAO_Component extends CRM_Core_DAO { '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' => [ @@ -194,8 +194,8 @@ class CRM_Mailing_DAO_Component extends CRM_Core_DAO { '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, ], ]; diff --git a/CRM/Mailing/Form/Component.php b/CRM/Mailing/Form/Component.php index 35074d30fd..b1875ee16b 100644 --- a/CRM/Mailing/Form/Component.php +++ b/CRM/Mailing/Form/Component.php @@ -62,24 +62,24 @@ class CRM_Mailing_Form_Component extends CRM_Core_Form { $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?')); diff --git a/CRM/Mailing/PseudoConstant.php b/CRM/Mailing/PseudoConstant.php index 5cb6f7dabf..bebcc3fc17 100644 --- a/CRM/Mailing/PseudoConstant.php +++ b/CRM/Mailing/PseudoConstant.php @@ -158,13 +158,13 @@ class CRM_Mailing_PseudoConstant extends CRM_Core_PseudoConstant { } 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"); diff --git a/api/v3/MailingComponent.php b/api/v3/MailingComponent.php index 997c28c0d6..693b7b9f91 100644 --- a/api/v3/MailingComponent.php +++ b/api/v3/MailingComponent.php @@ -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'); } diff --git a/api/v3/utils.php b/api/v3/utils.php index 094beb2375..bfa476adc4 100644 --- a/api/v3/utils.php +++ b/api/v3/utils.php @@ -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'; diff --git a/tests/phpunit/CRM/Core/PseudoConstantTest.php b/tests/phpunit/CRM/Core/PseudoConstantTest.php index ec83676b13..271d74d65f 100644 --- a/tests/phpunit/CRM/Core/PseudoConstantTest.php +++ b/tests/phpunit/CRM/Core/PseudoConstantTest.php @@ -912,7 +912,7 @@ class CRM_Core_PseudoConstantTest extends CiviUnitTestCase { 'sample' => $campaign_name, ), ), - 'CRM_Mailing_DAO_Component' => array( + 'CRM_Mailing_DAO_MailingComponent' => array( array( 'fieldName' => 'component_type', 'sample' => 'Header', diff --git a/xml/schema/Mailing/Component.xml b/xml/schema/Mailing/Component.xml index 76a27f027b..53f9c4a5c0 100644 --- a/xml/schema/Mailing/Component.xml +++ b/xml/schema/Mailing/Component.xml @@ -2,7 +2,7 @@ CRM/Mailing - Component + MailingComponentcivicrm_mailing_componentStores information about the mailing components (header/footer).