/** * Sets security roles * * @return self */ protected function setSecurityRolesAndTools() { $result = $this->mp->storedProcedure("api_blackpulp_GetUserRoles", ["UserID" => $this->id]); $this->roles = $result->getTableKeyValuePair(0); $this->tools = $result->getTableKeyValuePair(1); return $this; }
/** * Sets the $matches and $number_of_matches properties * * Executes the FindMatchingContact stored procedure via MinistryPlatform. * Also allows users to override the default stored procedure and the * parameters passed to the stored procedure. * * @param string $sp The name of the "Find Matching Contacts" Stored Procedure * * @return $this */ protected function setMatches() { $matching_fields = ["FirstName" => $this->first_name, "LastName" => $this->last_name]; $matching_fields = array_merge($matching_fields, $this->optional_fields); $this->matches = $this->mp->storedProcedure($this->sp, $matching_fields); if ($this->matches->getTableCount() > 0) { foreach ($this->matches->getTable(0) as $item) { if (is_array($item)) { $this->number_of_matches = count($this->matches->getTable(0)); } else { $this->number_of_matches = 1; } break; } } else { $this->number_of_matches = 0; } return $this; }
/** * Update $this->config by fetching fresh data from MinistryPlatform. * * @return Config */ public function updateConfigurationSettings() { $config = $this->mp->storedProcedure($this->stored_procedure, ['ApplicationCode' => $this->application_code]); $this->config = $config; return $this; }