Skip to content
This repository has been archived by the owner on Nov 26, 2021. It is now read-only.

Migration files are broken L5.2 #30

Open
yurtesen opened this issue Jul 2, 2016 · 6 comments
Open

Migration files are broken L5.2 #30

yurtesen opened this issue Jul 2, 2016 · 6 comments

Comments

@yurtesen
Copy link

yurtesen commented Jul 2, 2016

Well there are 2 problems:

1- The file names are like '2013_11_28_170337_create_geonames_names.php' but the class name inside the file is 'CreateGeonamesNamesTable'. Either the file name should be '2013_11_28_170337_create_geonames_names_table.php' or the class name should be 'CreateGeonamesNames'

Otherwise it just gives error:

  [Symfony\Component\Debug\Exception\FatalThrowableError]
  Class 'CreateGeonamesNames' not found

2- The composer dumpautoload is giving errors about duplicate migration files.

Writing lock file
Generating autoload files
Warning: Ambiguous class resolution, "CreateGeonamesNamesTable" was found in both "$baseDir . '/database/migrations/2013_11_28_170337_create_geonames_names.php" and "/laravel_directory/vendor/ipalaus/geonames/src/migrations/2013_11_28_170337_create_geonames_names.php", the first will be used.

I found the same problem mentioned in another issue but removing the classmap from vendor/ipalaus/geonames/composer.json did not help.

Any ideas on when you will fix these and make a release?

Thanks!

@yurtesen yurtesen changed the title Migration files are broken Migration files are broken L5.2 Jul 2, 2016
@elpado
Copy link

elpado commented Oct 13, 2016

Hi,

I've the same problem using the package in laravel 5.2.45. My solution was to remove the "Table" suffix from the migration class names. "CreateGeonamesNamesTable" becomes "CreateGeonamesNames" and so on. After that i can migrate the tables.

Hopefully this helps you :)

Best,
eL

@yurtesen
Copy link
Author

@elpado I have made my own package. It is so much nicer, faster and more complete. I had to wait 15 hours to import DBs using this package, my package does it in 30min. Also it can update the entries without deleting them. (but it does not fetch daily files, I think it is silly that geonames provide a file for only 1 day before) https://github.com/yurtesen/geonames/

@elpado
Copy link

elpado commented Oct 16, 2016

@yurtesen Great to here that. I now used your package cause the performance is impressive. Unfortunately the geonames db is new to me. How can I search for countries in the appropriate user language with your package to realize a autocompletion?

@yurtesen
Copy link
Author

@elpado if you have problems with my package please open an issue in my repository.

Your question is too generic. But if I understand you correctly, you want to fetch list of country names in X language. There are at least 2 ways to do this.

1- You get a list of geoname_id values from GeonamesCountryInfo then use GeonamesAlternateName to extract them in a certain language

2- Use GeonamesGeoname table to search for entries with feature code PCLI to get country geoname_id values then fetch the names in a language you want.

You should be able to use model relations to get a reasoanble query. But if you can't manage it, please open an issue in my package and make a more detailed explanation of your problem with an exact example.

In either case, I am not sure if geonames have complete list of all country names in every language. You may have missing countries in some languages if geonames is missing variables and you may have to implement workarounds for it...just a friendly warning :)

Under normal circumstances you should be able to follow the wiki entry about typeahead in my package for hints. (there are other wiki pages with examples)
https://github.com/yurtesen/geonames/wiki/Example:-Typeahead

@elpado
Copy link

elpado commented Oct 16, 2016

@yurtesen You're absolutely right, my question does not belongs to here. My mistake :(

But thanks for your help, I think now I've understood how I must use it.

I hope geonames covers the main languages for which my project is planned for (French, English, German, Spanish). Otherwise I would have to work with a fallback language or some other type of workaround. Nevertheless, thanks for the note :)

For further questions I will open an issue on your repo.

Best,
eL

@yurtesen
Copy link
Author

I tested this and I am getting some duplicate names because some countries have multiple names in a language in alternateNames table ( there are historical names, preferred names etc. ).
If you are only after country names, perhaps geonames is too much for you. I am using it for all the cities and towns etc. in the world. (You probably saw the examples in my wiki pages)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants