do not fetch TwingleCampaign in _construct()
This commit is contained in:
parent
dc2c26abb4
commit
154f9d2d34
1 changed files with 8 additions and 10 deletions
|
@ -24,25 +24,23 @@ class CRM_TwingleCampaign_BAO_TwingleCampaign {
|
||||||
* ## TwingleCampaign constructor
|
* ## TwingleCampaign constructor
|
||||||
*
|
*
|
||||||
* @param array|null $values
|
* @param array|null $values
|
||||||
|
* @param int|null $id
|
||||||
*
|
*
|
||||||
* @throws CiviCRM_API3_Exception
|
* @throws \CiviCRM_API3_Exception
|
||||||
*/
|
*/
|
||||||
public function __construct(array $values = NULL) {
|
public function __construct(array $values, int $id = NULL) {
|
||||||
|
|
||||||
$this->prefix = 'twingle_campaign_';
|
$this->prefix = 'twingle_campaign_';
|
||||||
$this->id = $values['id'] ?? NULL;
|
$this->id = $id ?? NULL;
|
||||||
$this->values['campaign_type_id'] = 'twingle_campaign';
|
$this->values['campaign_type_id'] = 'twingle_campaign';
|
||||||
|
|
||||||
if ($this->id) {
|
if ($this->id) {
|
||||||
$this->fetch();
|
$this->update($values);
|
||||||
if ($values) {
|
|
||||||
$this->update($values);
|
|
||||||
}
|
|
||||||
$this->getParentProject();
|
$this->getParentProject();
|
||||||
$this->createCid();
|
$this->createCid();
|
||||||
$this->createUrl();
|
$this->createUrl();
|
||||||
}
|
}
|
||||||
elseif ($values) {
|
else {
|
||||||
$this->update($values);
|
$this->update($values);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,8 +81,8 @@ class CRM_TwingleCampaign_BAO_TwingleCampaign {
|
||||||
* @throws CiviCRM_API3_Exception
|
* @throws CiviCRM_API3_Exception
|
||||||
*/
|
*/
|
||||||
private function fetch() {
|
private function fetch() {
|
||||||
$this->values = civicrm_api3('Campaign', 'getsingle',
|
$this->values = civicrm_api3('TwingleCampaign', 'getsingle',
|
||||||
['id' => $this->id]);
|
['id' => $this->id])['values'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue