Use only two leading number of zipcode to group cities
Improve modified date computing
'updated' => $data['updated'],
//XXX: Useless ???
'slug' => $location = $this->slugger->slug($title),
'updated' => $data['updated'],
//XXX: Useless ???
'slug' => $location = $this->slugger->slug($title),
- 'link' => $this->router->generate('rapsys_air_location_view', ['id' => $data['id'], 'location' => $this->slugger->slug($location)])
+ 'link' => $this->router->generate('rapsysair_location_view', ['id' => $data['id'], 'location' => $this->slugger->slug($location)])
GROUP_CONCAT(a.longitude ORDER BY a.pcount DESC, a.count DESC, a.id SEPARATOR "\\n") AS longitudes,
GROUP_CONCAT(a.indoor ORDER BY a.pcount DESC, a.count DESC, a.id SEPARATOR "\\n") AS indoors,
GROUP_CONCAT(a.count ORDER BY a.pcount DESC, a.count DESC, a.id SEPARATOR "\\n") AS counts,
GROUP_CONCAT(a.longitude ORDER BY a.pcount DESC, a.count DESC, a.id SEPARATOR "\\n") AS longitudes,
GROUP_CONCAT(a.indoor ORDER BY a.pcount DESC, a.count DESC, a.id SEPARATOR "\\n") AS indoors,
GROUP_CONCAT(a.count ORDER BY a.pcount DESC, a.count DESC, a.id SEPARATOR "\\n") AS counts,
- MAX(a.updated) AS modified
+ MAX(a.modified) AS modified
l.latitude,
l.longitude,
l.indoor,
l.latitude,
l.longitude,
l.indoor,
+ GREATEST(l.created, l.updated, COALESCE(s.created, 0), COALESCE(s.updated, 0)) AS modified,
l.zipcode,
COUNT(s.id) AS count,
COUNT(IF(s.date BETWEEN :begin AND :end, s.id, NULL)) AS pcount
l.zipcode,
COUNT(s.id) AS count,
COUNT(IF(s.date BETWEEN :begin AND :end, s.id, NULL)) AS pcount
ORDER BY NULL
LIMIT 0, :limit
) AS a
ORDER BY NULL
LIMIT 0, :limit
) AS a
-GROUP BY a.city, SUBSTRING(a.zipcode, 1, 3)
-ORDER BY a.city, SUBSTRING(a.zipcode, 1, 3)
+GROUP BY a.city, SUBSTRING(a.zipcode, 1, 2)
+ORDER BY a.city, a.zipcode
SQL;
//Replace bundle entity name by table name
SQL;
//Replace bundle entity name by table name
'latitude' => floatval($latitudes[$k]),
'longitude' => floatval($longitudes[$k]),
'indoor' => $indoors[$k] == 0 ? $this->translator->trans('outdoor') : $this->translator->trans('indoor'),
'latitude' => floatval($latitudes[$k]),
'longitude' => floatval($longitudes[$k]),
'indoor' => $indoors[$k] == 0 ? $this->translator->trans('outdoor') : $this->translator->trans('indoor'),
- 'link' => $this->router->generate('rapsys_air_location_view', ['id' => $id, 'location' => $this->slugger->slug($location)])
+ 'link' => $this->router->generate('rapsysair_location_view', ['id' => $id, 'location' => $this->slugger->slug($location)])
'modified' => $data['modified'],
//XXX: Useless ???
'slug' => $city = $this->slugger->slug($data['city']),
'modified' => $data['modified'],
//XXX: Useless ???
'slug' => $city = $this->slugger->slug($data['city']),
- 'link' => $this->router->generate('rapsys_air_city_view', ['city' => $city, 'latitude' => $data['latitude'], 'longitude' => $data['longitude']]),
+ 'link' => $this->router->generate('rapsysair_city_view', ['city' => $city, 'latitude' => $data['latitude'], 'longitude' => $data['longitude']]),
'locations' => $data['locations']
];
}
'locations' => $data['locations']
];
}
ROUND(AVG(l.longitude), 6) AS longitude,
MAX(l.updated) AS updated
FROM Rapsys\AirBundle\Entity\Location AS l
ROUND(AVG(l.longitude), 6) AS longitude,
MAX(l.updated) AS updated
FROM Rapsys\AirBundle\Entity\Location AS l
-GROUP BY city, SUBSTRING(l.zipcode, 1, 3)
+GROUP BY city, SUBSTRING(l.zipcode, 1, 2)
ORDER BY ACOS(SIN(RADIANS(:latitude))*SIN(RADIANS(l.latitude))+COS(RADIANS(:latitude))*COS(RADIANS(l.latitude))*COS(RADIANS(:longitude - l.longitude)))*40030.17/2/PI()
LIMIT 0, 1
SQL;
ORDER BY ACOS(SIN(RADIANS(:latitude))*SIN(RADIANS(l.latitude))+COS(RADIANS(:latitude))*COS(RADIANS(l.latitude))*COS(RADIANS(:longitude - l.longitude)))*40030.17/2/PI()
LIMIT 0, 1
SQL;
'multimap' => $this->translator->trans($result['city'].' sector map'),
//XXX: Useless ???
'slug' => $slug = $this->slugger->slug($result['city']),
'multimap' => $this->translator->trans($result['city'].' sector map'),
//XXX: Useless ???
'slug' => $slug = $this->slugger->slug($result['city']),
- 'link' => $this->router->generate('rapsys_air_city_view', ['city' => $slug, 'latitude' => $result['latitude'], 'longitude' => $result['longitude']])
+ 'link' => $this->router->generate('rapsysair_city_view', ['city' => $slug, 'latitude' => $result['latitude'], 'longitude' => $result['longitude']])
a.title,
a.latitude,
a.longitude,
a.title,
a.latitude,
a.longitude,
- MAX(a.updated) AS modified,
+ MAX(GREATEST(a.modified, COALESCE(s.created, 0), COALESCE(s.updated, 0))) AS modified,
COUNT(s.id) AS count
FROM (
SELECT
COUNT(s.id) AS count
FROM (
SELECT
l.title,
l.latitude,
l.longitude,
l.title,
l.latitude,
l.longitude,
+ l.created,
+ l.updated,
+ GREATEST(l.created, l.updated) AS modified
FROM Rapsys\AirBundle\Entity\Location AS l
WHERE l.latitude BETWEEN :minlat AND :maxlat AND l.longitude BETWEEN :minlong AND :maxlong
LIMIT 0, :limit
FROM Rapsys\AirBundle\Entity\Location AS l
WHERE l.latitude BETWEEN :minlat AND :maxlat AND l.longitude BETWEEN :minlong AND :maxlong
LIMIT 0, :limit
->addScalarResult('title', 'title', 'string')
->addScalarResult('latitude', 'latitude', 'float')
->addScalarResult('longitude', 'longitude', 'float')
->addScalarResult('title', 'title', 'string')
->addScalarResult('latitude', 'latitude', 'float')
->addScalarResult('longitude', 'longitude', 'float')
+ ->addScalarResult('created', 'created', 'datetime')
->addScalarResult('updated', 'updated', 'datetime')
->addScalarResult('modified', 'modified', 'datetime')
->addScalarResult('count', 'count', 'integer');
->addScalarResult('updated', 'updated', 'datetime')
->addScalarResult('modified', 'modified', 'datetime')
->addScalarResult('count', 'count', 'integer');
'title' => $title = $this->translator->trans($data['title']),
'latitude' => $data['latitude'],
'longitude' => $data['longitude'],
'title' => $title = $this->translator->trans($data['title']),
'latitude' => $data['latitude'],
'longitude' => $data['longitude'],
+ 'created' => $data['created'],
'updated' => $data['updated'],
'modified' => $data['modified'],
'count' => $data['count'],
'slug' => $slug = $this->slugger->slug($title),
'updated' => $data['updated'],
'modified' => $data['modified'],
'count' => $data['count'],
'slug' => $slug = $this->slugger->slug($title),
- 'link' => $this->router->generate('rapsys_air_location_view', ['id' => $data['id'], 'location' => $slug])
+ 'link' => $this->router->generate('rapsysair_location_view', ['id' => $data['id'], 'location' => $slug])
'tcount' => $data['tcount'],
'modified' => $data['modified'],
'slug' => $slug = $this->slugger->slug($title),
'tcount' => $data['tcount'],
'modified' => $data['modified'],
'slug' => $slug = $this->slugger->slug($title),
- 'link' => $this->router->generate('rapsys_air_location_view', ['id' => $data['id'], 'location' => $slug])
+ 'link' => $this->router->generate('rapsysair_location_view', ['id' => $data['id'], 'location' => $slug])
ROUND(AVG(l2.latitude), 6) AS city_latitude,
ROUND(AVG(l2.longitude), 6) AS city_longitude
FROM Rapsys\AirBundle\Entity\Location AS l
ROUND(AVG(l2.latitude), 6) AS city_latitude,
ROUND(AVG(l2.longitude), 6) AS city_longitude
FROM Rapsys\AirBundle\Entity\Location AS l
-JOIN Rapsys\AirBundle\Entity\Location AS l2 ON (l2.city = l.city AND SUBSTRING(l.zipcode, 1, 3) = SUBSTRING(l.zipcode, 1, 3))
+JOIN Rapsys\AirBundle\Entity\Location AS l2 ON (l2.city = l.city AND SUBSTRING(l2.zipcode, 1, 3) = SUBSTRING(l.zipcode, 1, 3))
WHERE l.id = :id
GROUP BY l.id
LIMIT 0, 1
WHERE l.id = :id
GROUP BY l.id
LIMIT 0, 1
$result['alternates'] = [];
//Set route
$result['alternates'] = [];
//Set route
- $route = 'rapsys_air_location_view';
+ $route = 'rapsysair_location_view';
//Set route params
$routeParams = ['id' => $id];
//Set route params
$routeParams = ['id' => $id];
'id' => $result['city_id'],
'title' => $result['city'],
'in' => $this->translator->trans('in '.$result['city']),
'id' => $result['city_id'],
'title' => $result['city'],
'in' => $this->translator->trans('in '.$result['city']),
- 'link' => $this->router->generate('rapsys_air_city_view', ['city' => $result['city'], 'latitude' => $result['city_latitude'], 'longitude' => $result['city_longitude']])
+ 'link' => $this->router->generate('rapsysair_city_view', ['city' => $result['city'], 'latitude' => $result['city_latitude'], 'longitude' => $result['city_longitude']])
],
'title' => $title = $this->translator->trans($result['title']),
'latitude' => $result['latitude'],
],
'title' => $title = $this->translator->trans($result['title']),
'latitude' => $result['latitude'],