Beispiel #1
0
 /**
  * Get all linked clients based on given project
  *
  * @return array<Model\LinkedProjectClient>
  */
 public function getRelatedPartiesByProject(Model\Project $project)
 {
     $action = 'getRelatedPartiesByProject.php';
     $parameters = ['project_id' => $project->getId()];
     $response = $this->doRequest($action, $parameters);
     $parties = [];
     foreach ($response as $client) {
         $projectClient = new Model\LinkedProjectClient();
         $projectClient->setProject($project);
         switch ($client['type']) {
             case 'company':
                 $projectClient->setClient(Model\Company::_create($client));
                 break;
             case 'contact':
                 $projectClient->setClient(Model\Contact::_create($client));
                 break;
         }
         $projectClient->setGroup($client['group']);
         $projectClient->setRole($client['role']);
         $parties[] = $projectClient;
     }
     return $parties;
 }
Beispiel #2
0
 /**
  * Get company
  *
  * @param integer $id
  * @return Model\Company
  */
 public function getCompany($id)
 {
     $action = 'getCompany.php';
     $parameters = ['company_id' => (int) $id];
     $response = $this->doRequest($action, $parameters);
     if (!empty($response)) {
         return Model\Company::_create($response);
     }
     return null;
 }