protected function execute($arguments = array(), $options = array())
 {
     $time = microtime(true);
     $this->init($arguments, $options);
     $count = 0;
     $this->printDebug("Matching OpenSecrets entities with OpenSecrets industry codes...");
     if (in_array('Person', $this->types)) {
         $persons = $this->getUnmatchedPersons();
         foreach ($persons as $person) {
             if ($this->isMatched($person['id'])) {
                 continue;
             }
             $this->printDebug("\nProcessing " . $person['name'] . " [" . $person['id'] . "]...");
             $newCategories = OsPerson::updateCategories($person['id']);
             foreach ($newCategories as $categoryId) {
                 $this->printDebug("+ added industry category: " . $this->getCategoryName($categoryId) . " [" . $categoryId . "]");
             }
             $count++;
         }
     }
     if (in_array('Org', $this->types)) {
         $orgs = $this->getUnmatchedOrgs();
         foreach ($orgs as $org) {
             if ($this->isMatched($org['id'])) {
                 continue;
             }
             if ($this->isSkippableEntity($org['id'])) {
                 continue;
             }
             $this->printDebug("\nProcessing " . $org['name'] . " [" . $org['id'] . "]...");
             $newCategories = OsOrg::updateCategories($org['id'], $org['name'], $this->exactNameOverride);
             foreach ($newCategories as $categoryId) {
                 $this->printDebug("+ added industry category: " . $this->getCategoryName($categoryId) . " [" . $categoryId . "]");
             }
             $count++;
         }
     }
     print "\nMatched " . $count . " entities with OpenSecrets industry codes in " . (microtime(true) - $time) . " s\n";
     //DONE
     LsCli::beep();
 }
Esempio n. 2
0
 public function executeUpdateIndustries($request)
 {
     $this->checkEntity($request, false, false);
     if (!$request->isMethod('post')) {
         $this->forward('error', 'invalid');
     }
     if ($this->entity['primary_ext'] == 'Person') {
         $new = OsPerson::updateCategories($this->entity['id']);
     } else {
         $new = OsOrg::updateCategories($this->entity['id'], $this->entity['name'], $exactNameOverride = true);
     }
     $this->redirect(EntityTable::getInternalUrl($this->entity, 'editIndustries'));
 }