| Conditions | 2 |
| Paths | 2 |
| Total Lines | 19 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | public function afterElementSave(ElementInterface $element, bool $isNew) |
||
| 27 | { |
||
| 28 | |||
| 29 | $value = $element->getFieldValue( |
||
| 30 | $this->handle |
||
| 31 | ); |
||
| 32 | |||
| 33 | // Remove existing associations |
||
| 34 | HubSpot::getInstance()->getCompany()->disassociate($element); |
||
| 35 | |||
| 36 | if ($value) { |
||
| 37 | HubSpot::getInstance()->getCompany()->associateByIds( |
||
| 38 | $element->getId(), |
||
| 39 | $value |
||
| 40 | ); |
||
| 41 | } |
||
| 42 | |||
| 43 | parent::afterElementSave($element, $isNew); |
||
| 44 | } |
||
| 45 | } |
||
| 46 |