set object values via update() method to filter them
This commit is contained in:
parent
a9ebd8c514
commit
b210f42b8f
1 changed files with 9 additions and 11 deletions
|
@ -43,16 +43,6 @@ abstract class CRM_TwingleCampaign_BAO_Campaign {
|
|||
|
||||
// Set campaign values
|
||||
$this->update($campaign);
|
||||
|
||||
// Filter project values
|
||||
$filter = Cache::getInstance()->getTemplates()[$this->className];
|
||||
foreach ($campaign as $key => $value) {
|
||||
if (in_array($key, $filter)) {
|
||||
$this->values[$key] = $value;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -118,7 +108,15 @@ abstract class CRM_TwingleCampaign_BAO_Campaign {
|
|||
*/
|
||||
public function update(array $values) {
|
||||
// Update campaign values
|
||||
$this->values = array_merge($this->values, $values);
|
||||
$filter = Cache::getInstance()->getTemplates()[$this->className];
|
||||
foreach ($values as $key => $value) {
|
||||
if ($this->className == "TwingleProject" && $key == 'project_id') {
|
||||
$this->values['id'] = $value;
|
||||
}
|
||||
else if (in_array($key, $filter)) {
|
||||
$this->values[$key] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue