Skip to content

Commit

Permalink
Merge branch 'release/0.12.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
kayalion committed May 20, 2016
2 parents 13c710f + 4c335f9 commit 88d39ba
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 24 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ride/web-orm",
"description": "ORM application of the Ride framework",
"license": "MIT",
"version": "0.12.0",
"version": "0.12.1",
"authors": [
{
"name": "Joris Vandeweerd",
Expand Down
31 changes: 8 additions & 23 deletions src/ride/web/orm/form/row/GeoLocationRow.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,40 +93,25 @@ protected function setGeoLocationOptions() {
$expression = array();

$type = $this->getOption(self::OPTION_TYPE);
if ($type) {
if (is_array($type)) {
$types = array();
foreach ($type as $t) {
$types[$t] = '"' . $t . '"';
}

$expression[] = '{type} IN (' . implode(', ', $types) . ')';
} else {
$expression[] = '{type} = "' . $type . '"';
}
}

$filter = $this->getOption(self::OPTION_FILTER);
if ($filter) {
if (is_string($filter)) {
$expression[] = '{path} LIKE "%~' . $filter . '~%"';
} elseif ($filter instanceof GeoLocationEntry) {
$expression[] = '{path} LIKE "' . $filter->getPath() . '~%"';
}
if ($filter && $filter instanceof GeoLocationEntry) {
$filter = $filter->getPath();
}

$expression[] = '({name} LIKE "%%term%%" OR {code} LIKE "%%term%%")';

$queryParameters = array(
'list' => 1,
'fields' => array(
'geo-locations' => 'name',
'geo-locations' => 'code,name',
),
'filter' => array(
'expression' => implode(' AND ', $expression),
'term' => '%term%',
'type' => $type,
'path' => $filter,
),
);
$url = $this->web->getUrl('api.orm.entry.index', array('type' => 'geo-locations'), $queryParameters);

$url = $this->web->getUrl('api.orm.geo.search', null, $queryParameters);

$this->setOption(self::OPTION_AUTO_COMPLETE_URL, $url);
}
Expand Down

0 comments on commit 88d39ba

Please sign in to comment.