public function loadReferences() { $references = $this->get("references"); if ($references) { return $references; } $references = []; //initialize //so there is nothing in that empty array foreach ($this->expose_set() as $attr => $value) { //now we filter based on what we have vs. what Bullhorn knows if (preg_match("/(recommender\\d)_(.*)/", $attr, $m)) { $ref = null; if (array_key_exists($m[1], $references)) { $ref = $references[$m[1]]; } else { $ref = new \Stratum\Model\CandidateReference(); $ref->setLogger($this->_logger); $references[$m[1]] = $ref; $this->log_debug("Creating " . $m[1]); } $ref->set($m[2], $value); } } $this->set("references", $references); return $references; }
public function loadFully(\Stratum\Model\Candidate $candidate) { $candidate = $this->load($candidate); $this->log_debug("We have the candidate loaded - now the extras"); if ($candidate->get("id")) { $bullhornClient = $this->getClient(); $this->log_debug("Loading notes"); $candidate->set("notes", $bullhornClient->find_note($candidate)); $this->log_debug("Loading references"); $raw_references = $bullhornClient->find_candidate_references($candidate); $ref_objs = []; foreach ($raw_references as $raw_ref) { $ref_obj = new \Stratum\Model\CandidateReference(); $ref_obj->populateFromData($raw_ref); $ref_objs[] = $ref_obj; } $candidate->set("references", $ref_objs); $this->log_debug("Loading custom object 1"); $raw_obj = $bullhornClient->find_custom_object($candidate); $co = new \Stratum\Model\CustomObject(); $co->populateFromData($raw_obj); $candidate->set("customObject1s", $co); } return $candidate; }