/** * Get data from cache. * * @param string $address The address which where use for the search. * * @param string $country The country. * * @return Container|null */ protected function getFromCache($address, $country) { // Check cache. $result = $this->getDataBase()->prepare('SELECT * FROM tl_metamodel_perimetersearch WHERE search = ? AND country = ?')->execute($address, $country); // If we have no data just return null. if ($result->count() === 0) { return null; } // Build a new container. $container = new Container(); $container->setLatitude($result->geo_lat); $container->setLongitude($result->geo_long); $container->setSearchParam($result->query); return $container; }