Giter VIP home page Giter VIP logo

geoname-bundle's People

Contributors

bordeux avatar tacman avatar treeindark avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

geoname-bundle's Issues

[WARNING] Some commands could not be registered

I have a problem with command php bin/console bordeux:geoname:import

Type error: Argument 4 passed to Symfony\Component\Console\Input\InputOption::__construct() must be of the type string, null given, called in /var/www/vendor/symfony/console/Command/Command.php on line 388

but problem was fixed into the master branch but not included to the last version.

It possible to publish new version of bundle?

Bundle Brainstorming

I quite like Symfony's Intl bundle, which provides data about countries, currency and timezones. https://symfony.com/doc/current/components/intl.html

Geonames provides so much data, and this bundle loads it. My idea is to add a service to the bundle that allows the developer access to administrative data, like "state" and "city". (in quotes because they're not accurate, but easily understandable.)

If the bundle used its own entity manager, it could store the data in SQLite. Of course, there would need to be a step to load the data. So the workflow would be:

  • Install the bundle
  • Configure geonames.yaml, e.g.
    Countries: US, CA, PO
  • Populate the sqlite database with the existing :import command.

Then the service could provider a wrapper to the repository lookups, using either the 2 or 3 letter ISO codes (for the higher level) or the Ascii name or geoname ID for the lower levels.

Thoughts?

Exception while importing countries

An exception occurred while executing 'INSERT INTO geo__country (id, iso, iso3, iso_numeric, fips, name, capital, area, population, tld, currency, currency_name, phone_prefix, postal_format, postal  
  _regex, languages, geoname_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params ["6251999", "CA", "CAN", "124", "CA", "Canada", "Ottawa", 9984670, 33679000, ".ca", "CAD", "Do  
  llar", "1", "@#@ #@#", "^([ABCEGHJKLMNPRSTVXY]\\d[ABCEGHJKLMNPRSTVWXYZ]) ?(\\d[ABCEGHJKLMNPRSTVWXYZ]\\d)$", "[\"en-CA\",\"fr-CA\",\"iu\"]", 6251999]:                                                  
  SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'postal_regex' at row 1

at master branch

[RESOLVED] Use in SF5

Hello there,

I'm trying to use the geoname bundle you provide in SF5 application,

Actually, i've installed using composer your package, and updated config/bundles.php with the following :

Bordeux\Bundle\GeoNameBundle\BordeuxGeoNameBundle::class => ['all' => true],

After running a schema update, i'm getting this error :

2021-01-30T19:28:38+01:00 [critical] Uncaught Error: Too few arguments to function Symfony\Component\Config\Definition\Builder\TreeBuilder::__construct(), 0 passed in /home/brawcks/Projects/cowww/code-projet/symfony/vendor/bordeux/geoname-bundle/DependencyInjection/Configuration.php on line 20 and at least 1 expected

Do you have any advice on what should i do ? In case i find what's wrong, i'll close this issue.

Thanks if you can provide some help :)

++

can't import

bordeux:geoname:import". Message: "An exception occurred while executing a query: SQLSTATE[22003]: Numeric value out of range: 7 ERREUR: la valeur « 2400000000 » est en dehors des limites pour le type integer" {"exception":"[object] (Doctrine\\DBAL\\Exception\\DriverException(code: 7): An exception occurred while executing a query: SQLSTATE[22003]: Numeric value out of range: 7 ERREUR: la valeur « **2400000000** » est en dehors des limites pour le type integer at /var/www/vendor/doctrine/dbal/src/Driver/API/PostgreSQL/ExceptionConverter.php:87)\n[previous exception] [object] (Doctrine\\DBAL\\Driver\\PDO\\Exception(code: 7): SQLSTATE[22003]: Numeric value out of range: 7 ERREUR: la valeur « 2400000000 » est en dehors des limites pour le type integer at /var/www/vendor/doctrine/dbal/src/Driver/PDO/Exception.php:28)\n[previous exception] [object] (PDOException(code: 22003): SQLSTATE[22003]: Numeric value out of range: 7 ERREUR: la valeur « 2400000000 » est en dehors des limites pour le type integer at /var/www/vendor/doctrine/dbal/src/Driver/PDO/Statement.php:130)","command":"bordeux:geoname:import","message":"An exception occurred while executing a query: SQLSTATE[22003]: Numeric value out of range: 7 ERREUR: la valeur « 2400000000 » est en dehors des limites pour le type integer"} []

all int4 convert to int8, but... error,
found value 2400000000 in population? (int8) allcountry file

11812257 Commonwealth of Nations Commonwealth of Nations British Commonwealth of Nations 51.50488 -0.13602 A ZN GB AG,AU,BB,BD,BN,BS,BW,BZ,CA,CM,CY,DM,FJ,GB,GD,GH,GY,IN,JM,KE,KI,KN,LC,LK,LS,MT,MU,MW,MY,MZ,NA,NG,NR,NZ,PG,PK,RW,SB,SC,SG,SL,SZ,TO,TT,TV,TZ,UG,VC,VU,WS,ZA,ZM 2400000000 19 Europe/London 2018-09-02

New install on symfony fails to import.

Fails while importing https://download.geonames.org/export/dump/allCountries.zip#allCountries.txt

Environment

  • Mac M1
  • bin/console -V
    Symfony 6.2.11 (env: dev, debug: true)
  • mysql -V
    mysql Ver 15.1 Distrib 10.11.3-MariaDB, for osx10.18 (arm64) using EditLine wrapper

Any ideas?

Thank You!

Steps To reproducs:

  1. new symfony
  2. composer require bordeux/geoname-bundle
  3. php bin/console doctrine:database:create
  4. php bin/console doctrine:schema:update --force

[WARNING] Not passing the "--complete" option to "doctrine:schema:update" is deprecated and will
not be supported when using doctrine/dbal 4

Updating database schema...

 18 queries were executed

[OK] Database schema updated successfully!

  1. php bin/console bordeux:geoname:import --env=prod

php bin/console bordeux:geoname:import --env=prod

Start importing TimeZones from https://download.geonames.org/export/dump/timeZones.txt
100/100 [======================] 100% < 1 sec/< 1 sec Mem: 8.0 MiB Downloading data for TimeZones100/100 [==========================] 100% < 1 sec/< 1 sec Mem: 14.0 MiB Importing data: TimeZones
Finished importing TimeZones

Start importing Administrative from https://download.geonames.org/export/dump/admin1CodesASCII.txt
100/100 [================] 100% < 1 sec/< 1 sec Mem: 14.0 MiB Downloading data for Administrative100/100 [=====================] 100% 1 sec/1 sec Mem: 26.0 MiB Importing data: Administrative
Finished importing Administrative

Start importing Administrative 2 from https://download.geonames.org/export/dump/admin2Codes.txt
100/100 [==============] 100% < 1 sec/< 1 sec Mem: 26.0 MiB Downloading data for Administrative 2100/100 [===================] 100% 4 secs/4 secs Mem: 48.0 MiB Importing data: Administrative 2
Finished importing Administrative 2

Start importing Administrative 2 from https://download.geonames.org/export/dump/admin2Codes.txt
100/100 [==============] 100% < 1 sec/< 1 sec Mem: 48.0 MiB Downloading data for Administrative 2100/100 [===================] 100% 3 secs/3 secs Mem: 48.0 MiB Importing data: Administrative 2
Finished importing Administrative 2

Start importing GeoNames from https://download.geonames.org/export/dump/allCountries.zip#allCountries.txt
100/100 [======================] 100% 19 secs/19 secs Mem: 48.0 MiB Downloading data for GeoNames 0/100 [>--------------------------] 0% < 1 sec/< 1 sec Mem: 48.0 MiB Importing data: GeoNames{"message":"Error thrown while running command "bordeux:geoname:import --env=prod". Message: "An exception occurred while executing a query: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '>>'geoname_id')::integer,\n (_v.value->>'name'),\n ...' at line 22"","context":{"exception":{"class":"Doctrine\DBAL\Exception\SyntaxErrorException","message":"An exception occurred while executing a query: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '>>'geoname_id')::integer,\n (_v.value->>'name'),\n ...' at line 22","code":1064,"file":"/Users/pascal/PhpstormProjects/Elektra/vendor/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php:86","previous":{"class":"Doctrine\DBAL\Driver\PDO\Exception","message":"SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '>>'geoname_id')::integer,\n (_v.value->>'name'),\n ...' at line 22","code":1064,"file":"/Users/pascal/PhpstormProjects/Elektra/vendor/doctrine/dbal/src/Driver/PDO/Exception.php:28","previous":{"class":"PDOException","message":"SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '>>'geoname_id')::integer,\n (_v.value->>'name'),\n ...' at line 22","code":42000,"file":"/Users/pascal/PhpstormProjects/Elektra/vendor/doctrine/dbal/src/Driver/PDO/Statement.php:121"}}},"command":"bordeux:geoname:import --env=prod","message":"An exception occurred while executing a query: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '>>'geoname_id')::integer,\n (_v.value->>'name'),\n ...' at line 22"},"level":500,"level_name":"CRITICAL","channel":"console","datetime":"2023-05-29T13:03:34.151985+00:00","extra":{}}

An exception occurred while executing a query: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '>>'geoname_id')::integer,

Drop support for PHP5, Symfony < 4.4

PHP5 and Symfony 2 have been dead for a while. Symfony 3 is at EOL, officially dead in November.

What do you think about bumping the minimum version to PHP 7.4 and Symfony 4.4?

We could type the private vars, and get rid of some mistakes that are in the code now, such as float/string discrepancies:

    /**
     * @var float
     *
     * @ORM\Column(name="feature_code", type="string", length=10, nullable=true)
     */
    protected $featureCode;

    /**
     * @var float
     *
     * @ORM\Column(name="country_code", type="string", length=2, nullable=true)
     */
    protected $countryCode;

I've been bumping all my projects to PHP8, and Symfony 6 will require it, so that's an option, too.

Symfony 5 compatibility

Could you please update your code to match symfony 5 compatibility?

`composer require bordeux/geoname-bundle
Using version ^1.5 for bordeux/geoname-bundle
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "5.0.*"
Your requirements could not be resolved to an installable set of packages.

Problem 1
- Installation request for bordeux/geoname-bundle ^1.5 -> satisfiable by bordeux/geoname-bundle[v1.5].
- bordeux/geoname-bundle v1.5 requires symfony/framework-bundle ~2.7|~3.0|~4.0 -> no matching package found.

Potential causes:

Read https://getcomposer.org/doc/articles/troubleshooting.md for further common problems.

Installation failed, reverting ./composer.json to its original content.
`

Local names

Is there a way to get names in local or specified locale?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.