Fix BAO class namespace issues
This commit is contained in:
parent
82952a0162
commit
c7c766d926
10 changed files with 16 additions and 22 deletions
|
@ -1,6 +1,5 @@
|
|||
<?php
|
||||
use CRM_Twingle_ExtensionUtil as E;
|
||||
use Civi\Twingle\Shop\BAO\TwingleShop;
|
||||
use Civi\Twingle\Shop\Exceptions\ShopException;
|
||||
|
||||
/**
|
||||
|
@ -62,7 +61,7 @@ function civicrm_api3_twingle_shop_Create($params) {
|
|||
|
||||
try {
|
||||
// Create TwingleShop and load params
|
||||
$shop = new TwingleShop();
|
||||
$shop = new CRM_Twingle_BAO_TwingleShop();
|
||||
$shop->load($params);
|
||||
|
||||
// Save TwingleShop
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
use CRM_Twingle_ExtensionUtil as E;
|
||||
use Civi\Twingle\Shop\BAO\TwingleShop;
|
||||
|
||||
/**
|
||||
* TwingleShop.Delete API specification (optional)
|
||||
|
@ -56,10 +56,10 @@ function civicrm_api3_twingle_shop_Delete($params) {
|
|||
}
|
||||
|
||||
// Get TwingleShop object
|
||||
$shop = TwingleShop::findById($shop_data['id']);
|
||||
$shop = CRM_Twingle_BAO_TwingleShop::findById($shop_data['id']);
|
||||
|
||||
// Delete TwingleShop
|
||||
/* @var \Civi\Twingle\Shop\BAO\TwingleShop $shop */
|
||||
/** @var \CRM_Twingle_BAO_TwingleShop $shop */
|
||||
$result = $shop->deleteByConstraint();
|
||||
if ($result) {
|
||||
return civicrm_api3_create_success(1, $params, 'TwingleShop', 'Delete');
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?php
|
||||
|
||||
use CRM_Twingle_ExtensionUtil as E;
|
||||
use Civi\Twingle\Shop\BAO\TwingleShop;
|
||||
use Civi\Twingle\Shop\Exceptions\ApiCallError;
|
||||
use Civi\Twingle\Shop\Exceptions\ProductException;
|
||||
use Civi\Twingle\Shop\Exceptions\ShopException;
|
||||
|
@ -55,7 +54,7 @@ function civicrm_api3_twingle_shop_Fetch($params) {
|
|||
// Get products for all projects of type 'shop'
|
||||
foreach ($projectIds as $projectId) {
|
||||
try {
|
||||
$shop = TwingleShop::findByProjectIdentifier($projectId);
|
||||
$shop = CRM_Twingle_BAO_TwingleShop::findByProjectIdentifier($projectId);
|
||||
$products = $shop->fetchProducts();
|
||||
$returnValues[$projectId] = [];
|
||||
$returnValues[$projectId] += $shop->getAttributes();
|
||||
|
@ -63,7 +62,7 @@ function civicrm_api3_twingle_shop_Fetch($params) {
|
|||
return $product->getAttributes();
|
||||
}, $products);
|
||||
}
|
||||
catch (ShopException|ApiCallError|ProductException $e) {
|
||||
catch (ShopException | ApiCallError | ProductException $e) {
|
||||
// If this project identifier doesn't belong to a project of type
|
||||
// 'shop', just skip it
|
||||
if ($e->getErrorCode() == ShopException::ERROR_CODE_NOT_A_SHOP) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
use CRM_Twingle_ExtensionUtil as E;
|
||||
use Civi\Twingle\Shop\BAO\TwingleShop;
|
||||
|
||||
/**
|
||||
* TwingleShop.Get API specification (optional)
|
||||
|
@ -92,7 +92,7 @@ function civicrm_api3_twingle_shop_Get($params) {
|
|||
|
||||
// Execute query
|
||||
try {
|
||||
$dao = TwingleShop::executeQuery($query, $query_params);
|
||||
$dao = CRM_Twingle_BAO_TwingleShop::executeQuery($query, $query_params);
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
return civicrm_api3_create_error($e->getMessage(), [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue