コード例 #1
0
ファイル: Munt.php プロジェクト: AlexEvesDeveloper/hl-stuff
 protected function _pushToEmploymentMunt($reference)
 {
     $occupationDatasource = new Datasource_ReferencingLegacy_Occupations();
     //If the reference subject is self employed and has a future employer, then the Munt only
     //recognizes the future employer and does not record the current....
     $occupationManager = new Manager_Referencing_Occupation();
     $currentOccupation = $occupationManager->findSpecificOccupation($reference->referenceSubject->occupations, Model_Referencing_OccupationChronology::CURRENT, Model_Referencing_OccupationImportance::FIRST);
     $futureOccupation = $occupationManager->findSpecificOccupation($reference->referenceSubject->occupations, Model_Referencing_OccupationChronology::FUTURE, Model_Referencing_OccupationImportance::FIRST);
     if ($currentOccupation->type == Model_Referencing_OccupationTypes::SELFEMPLOYMENT) {
         if (!empty($futureOccupation)) {
             if ($futureOccupation->type == Model_Referencing_OccupationTypes::EMPLOYMENT) {
                 $occupationDatasource->insertOccupation($futureOccupation, $reference->externalId);
                 return;
             }
         }
     }
     // Loop round the occupations. If the occupation is insertable, then
     // insert it.
     foreach ($reference->referenceSubject->occupations as $occupation) {
         switch ($occupation->type) {
             case Model_Referencing_OccupationTypes::EMPLOYMENT:
             case Model_Referencing_OccupationTypes::CONTRACT:
             case Model_Referencing_OccupationTypes::SELFEMPLOYMENT:
             case Model_Referencing_OccupationTypes::INDEPENDENT:
             case Model_Referencing_OccupationTypes::RETIREMENT:
                 //Insert the occupation
                 $occupationDatasource->insertOccupation($occupation, $reference->externalId);
                 break;
         }
     }
 }