/**
  * Update the entity with data from pipedrive
  *
  * @param Entity $fromPipedrive
  * @param OutputInterface $output
  * @return bool
  */
 protected function updateOtrs(Entity $fromPipedrive, OutputInterface $output)
 {
     if (!$fromPipedrive->getTaxId()) {
         $this->message($fromPipedrive, $output, 'No tax_id on Pipedrive', 'error');
         return false;
     }
     $toOtrs = $this->getCustomerCompany($fromPipedrive->getTaxId());
     $toOtrs->fill($fromPipedrive->toArray());
     if (!$toOtrs->isDirty()) {
         $this->message($fromPipedrive, $output, 'Nothing to update', 'comment');
         return false;
     }
     $this->message($fromPipedrive, $output, 'Updating...');
     $this->otrsCompanyRepo->update($toOtrs);
 }
Esempio n. 2
0
 public function __construct($attributes)
 {
     if (array_key_exists(self::API_TAX_ID, $attributes)) {
         $attributes['tax_id'] = $attributes[self::API_TAX_ID];
     }
     parent::__construct($attributes);
 }