/** * Builds the short URL data from the database into a collection of short URLs * * @param MySqlRawData $o_result */ public function BuildItems(MySqlRawData $o_result) { if ($this->o_current_format instanceof ShortUrlFormat) { $s_url_field = $this->o_current_format->GetShortUrlField(); while ($o_row = $o_result->fetch()) { if (isset($o_row->{$s_url_field})) { $url = new ShortUrl(); $url->SetFormat($this->o_current_format); $url->SetShortUrl($o_row->{$s_url_field}); $a_param_values = array(); foreach ($this->o_current_format->GetParameterFields() as $s_param_field) { $s_param_field = (string) $s_param_field; if (isset($o_row->{$s_param_field})) { $a_param_values[] = $o_row->{$s_param_field}; } } $url->SetParameterValues($a_param_values); $this->Add($url); } } } }