Fix BAO class namespace issues
This commit is contained in:
parent
82952a0162
commit
c7c766d926
10 changed files with 16 additions and 22 deletions
|
@ -2,7 +2,6 @@
|
|||
|
||||
use Civi\Twingle\Shop\Exceptions\ProductException;
|
||||
use CRM_Twingle_ExtensionUtil as E;
|
||||
use Civi\Twingle\Shop\BAO\TwingleProduct;
|
||||
|
||||
/**
|
||||
* TwingleProduct.Create API specification (optional)
|
||||
|
@ -121,7 +120,7 @@ function civicrm_api3_twingle_product_Create($params): array {
|
|||
|
||||
try {
|
||||
// Create TwingleProduct and load params
|
||||
$product = new TwingleProduct();
|
||||
$product = new CRM_Twingle_BAO_TwingleProduct();
|
||||
$product->load($params);
|
||||
|
||||
// Save TwingleProduct
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?php
|
||||
|
||||
use CRM_Twingle_ExtensionUtil as E;
|
||||
use Civi\Twingle\Shop\BAO\TwingleProduct;
|
||||
|
||||
/**
|
||||
* TwingleProduct.Delete API specification (optional)
|
||||
|
@ -56,7 +55,7 @@ function civicrm_api3_twingle_product_Delete($params) {
|
|||
}
|
||||
|
||||
// Get TwingleProduct object
|
||||
$product = TwingleProduct::findById($product_data['id']);
|
||||
$product = CRM_Twingle_BAO_TwingleProduct::findById($product_data['id']);
|
||||
|
||||
// Delete TwingleProduct and associated PriceField and PriceFieldValue
|
||||
$result = $product->delete();
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?php
|
||||
|
||||
use CRM_Twingle_ExtensionUtil as E;
|
||||
use Civi\Twingle\Shop\BAO\TwingleProduct;
|
||||
|
||||
/**
|
||||
* TwingleProduct.Get API specification (optional)
|
||||
|
@ -87,7 +86,7 @@ function civicrm_api3_twingle_product_Get($params) {
|
|||
$altered_params = [];
|
||||
|
||||
// Specify product fields to define table prefix
|
||||
$productFields = array_keys(TwingleProduct::fields());
|
||||
$productFields = array_keys(CRM_Twingle_BAO_TwingleProduct::fields());
|
||||
|
||||
// Alter params (prefix with table name)
|
||||
foreach ($possible_params as $param) {
|
||||
|
@ -118,7 +117,7 @@ function civicrm_api3_twingle_product_Get($params) {
|
|||
|
||||
// Execute query
|
||||
try {
|
||||
$dao = TwingleProduct::executeQuery($query, $query_params);
|
||||
$dao = CRM_Twingle_BAO_TwingleProduct::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