Example #1
0
 /**
  * Parse data model of Teamleader for add/update
  *
  * @param Model\Company $company
  * @param array $parameters
  * @return array
  */
 protected function parseCompanyParameters(Model\Company $company, $parameters = [])
 {
     $fields = ['company_id' => $company->getId(), 'name' => $company->getName(), 'vat_code' => $company->getTaxCode(), 'city' => $company->getCity(), 'zipcode' => $company->getZipCode(), 'street' => $company->getStreet(), 'number' => $company->getNumber(), 'country' => $company->getCountry(), 'telephone' => $company->getTelephone(), 'website' => $company->getWebsite(), 'fax' => $company->getFax(), 'email' => $company->getEmail(), 'business_type' => $company->getBusinessType()];
     // @todo tags
     // Include dynamic extra addresses
     if ($company->getExtraAddresses()) {
         foreach ($company->getExtraAddresses() as $type => $data) {
             foreach ($data as $key => $value) {
                 $fields[$key . "_" . $type] = $value;
             }
         }
     }
     // Include the custom fields
     if ($company->getCustomFields()) {
         foreach ($company->getCustomFields() as $id => $value) {
             $fields['custom_field_' . $id] = $value;
         }
     }
     return array_merge($parameters, $fields);
 }