rename "Models" to "BAO" in paths and namespaces
This commit is contained in:
parent
4b2047fdb0
commit
aef6b64004
11 changed files with 82 additions and 50 deletions
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
|
||||
use CRM_TwingleCampaign_ExtensionUtil as E;
|
||||
use CRM\TwingleCampaign\Models as Models;
|
||||
use CRM\TwingleCampaign\BAO as BAO;
|
||||
|
||||
include E::path() . '/CRM/TwingleCampaign/Upgrader/models/CampaignType.php';
|
||||
include E::path() . '/CRM/TwingleCampaign/Upgrader/models/CustomField.php';
|
||||
include E::path() . '/CRM/TwingleCampaign/Upgrader/models/CustomGroup.php';
|
||||
include E::path() . '/CRM/TwingleCampaign/Upgrader/BAO/CampaignType.php';
|
||||
include E::path() . '/CRM/TwingleCampaign/Upgrader/BAO/CustomField.php';
|
||||
include E::path() . '/CRM/TwingleCampaign/Upgrader/BAO/CustomGroup.php';
|
||||
|
||||
/**
|
||||
* Collection of upgrade steps.
|
||||
|
@ -53,26 +53,26 @@ class CRM_TwingleCampaign_Upgrader extends CRM_TwingleCampaign_Upgrader_Base {
|
|||
|
||||
// Create campaign types
|
||||
foreach ($campaign_info['campaign_types'] as $campaign_type) {
|
||||
new Models\CampaignType($campaign_type);
|
||||
new BAO\CampaignType($campaign_type);
|
||||
}
|
||||
foreach (Models\CampaignType::getCampaignTypes() as $campaign_type) {
|
||||
foreach (BAO\CampaignType::getCampaignTypes() as $campaign_type) {
|
||||
$campaign_type->create();
|
||||
}
|
||||
|
||||
// Create custom groups
|
||||
foreach ($campaign_info['custom_groups'] as $custom_group) {
|
||||
foreach (Models\CampaignType::getCampaignTypes() as $campaign_type) {
|
||||
foreach (BAO\CampaignType::getCampaignTypes() as $campaign_type) {
|
||||
if ($campaign_type->getName() == $custom_group['campaign_type']) {
|
||||
$custom_group['extends_entity_column_value'] = $campaign_type->getValue();
|
||||
}
|
||||
}
|
||||
$cg = new Models\CustomGroup($custom_group);
|
||||
$cg = new BAO\CustomGroup($custom_group);
|
||||
$cg->create();
|
||||
}
|
||||
|
||||
// Create custom fields
|
||||
foreach ($campaign_info['custom_fields'] as $custom_field) {
|
||||
$cf = new Models\CustomField($custom_field);
|
||||
$cf = new BAO\CustomField($custom_field);
|
||||
$cf->create();
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ class CRM_TwingleCampaign_Upgrader extends CRM_TwingleCampaign_Upgrader_Base {
|
|||
|
||||
// Delete campaign types
|
||||
foreach ($campaign_info['campaign_types'] as $campaign_type) {
|
||||
$result = Models\CampaignType::fetch($campaign_type['name']);
|
||||
$result = BAO\CampaignType::fetch($campaign_type['name']);
|
||||
if ($result) {
|
||||
$result->delete();
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ class CRM_TwingleCampaign_Upgrader extends CRM_TwingleCampaign_Upgrader_Base {
|
|||
|
||||
// Delete custom groups
|
||||
foreach ($campaign_info['custom_groups'] as $custom_group) {
|
||||
$result = Models\CustomGroup::fetch($custom_group['name']);
|
||||
$result = BAO\CustomGroup::fetch($custom_group['name']);
|
||||
if ($result) {
|
||||
$result->delete();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace CRM\TwingleCampaign\Models;
|
||||
namespace CRM\TwingleCampaign\BAO;
|
||||
|
||||
use CRM_Civirules_Utils_LoggerFactory as Civi;
|
||||
|
||||
|
@ -106,7 +106,7 @@ class CampaignType {
|
|||
/**
|
||||
* @param $name
|
||||
*
|
||||
* @return \CRM\TwingleCampaign\Models\CampaignType|null
|
||||
* @return \CRM\TwingleCampaign\BAO\CampaignType|null
|
||||
* @throws \CiviCRM_API3_Exception
|
||||
*/
|
||||
public static function fetch($name) {
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace CRM\TwingleCampaign\Models;
|
||||
namespace CRM\TwingleCampaign\BAO;
|
||||
|
||||
use CRM_TwingleCampaign_ExtensionUtil as E;
|
||||
|
||||
|
@ -138,7 +138,7 @@ class CustomField {
|
|||
/**
|
||||
* @param $name
|
||||
*
|
||||
* @return array|\CRM\TwingleCampaign\Models\CustomField
|
||||
* @return array|\CRM\TwingleCampaign\BAO\CustomField
|
||||
* @throws \CiviCRM_API3_Exception
|
||||
*/
|
||||
public static function fetch($name = NULL) {
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace CRM\TwingleCampaign\Models;
|
||||
namespace CRM\TwingleCampaign\BAO;
|
||||
|
||||
use CRM_Civirules_Utils_LoggerFactory as Civi;
|
||||
|
||||
|
@ -105,7 +105,7 @@ class CustomGroup {
|
|||
/**
|
||||
* @param $name
|
||||
*
|
||||
* @return Models\CustomGroup
|
||||
* @return BAO\CustomGroup
|
||||
* @throws \CiviCRM_API3_Exception
|
||||
*/
|
||||
public static function fetch($name) {
|
Loading…
Add table
Add a link
Reference in a new issue