-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
What steps will reproduce the problem?
My script:
/path/to/countries.csv
id,country_code,country_name
1,Au,Australia
2,Cn,China
3,De,Germany
4,Kz,Kazakhstan
/path/to/cities.csv
id,name,country,latitude,longitude
1,Sidney,1,-33.8699,151.2082
2,Astana,4,51.1271,71.4884
3,Berlin,3,52.5106,13.4383
4,Almaty,4,43.2427,76.9548
5,Ust-Kamenogorsk,4,49.9075,82.6213
/path/to/networks.csv
first_ip,last_ip,city
"1.0.0.0","1.255.255.255",1
"2.0.0.0","2.255.255.255",2
"3.0.0.0","3.255.255.255",3
"4.0.0.0","4.255.255.255",4
"5.0.0.0","5.255.255.255",5
script.php
<?php
require_once('vendor/autoload.php');
$countries = (new Register('/path/to/countries.csv'))
->setCsv('UTF-8')
->setFirstRow(2)
->setId(1)
->addField('code', 2, new StringField(StringField::TRANSFORM_LOWER, 2))
->addField('name', 3, new StringField())
;
$cities = (new Register('/path/to/cities.csv'))
->setCsv('UTF-8')
->setFirstRow(2)
->setId(1)
->addField('name', 2, new StringField(0))
->addField('countryId', 3, new NumericField(0))
->addField('latitude', 4, new LatitudeField())
->addField('longitude', 5, new LongitudeField())
;
$network = (new Network('/path/to/networks.csv', Network::IP_TYPE_ADDRESS, 1, 2))
->setCsv('UTF-8')
->setFirstRow(2)
;
$wizard = (new Wizard('/path/to/tmp'))
->setAuthor('Ipstack wizard')
->setTime(time())
->setLicense('WTFPL')
->addRegister('city', $cities)
->addRegister('country', $countries)
->addRelation('city', 'countryId', 'country')
->addNetwork(
$network,
array(
3 => 'city',
)
)
;
$wizard->compile('ipstack.dat');
$finder = new Finder('ipstack.dat');
$finder->getRegister('country');
$finder->getRegister('city');What is the expected result?
Array
(
...
[3] => Array
(
[code] => de
[name] => Germany
)
...
)
Array
(
...
[3] => Array
(
[name] => Berlin
[countryId] => 3
[latitude] => 52.510601043701
[longitude] => 13.438300132751
)
....
)
What do you get instead?
Array
(
...
[3] => Array
(
[code] => kz
[name] => Kazakhstan
)
...
)
Array
(
...
[3] => Array
(
[name] => Berlin
[countryId] => 3
[latitude] => 52.510601043701
[longitude] => 13.438300132751
)
....
)
Berlin is not in Kazakhstan!
Additional info
| Q | A |
|---|---|
| Wizard version | 2.0.0 |
| PHP version | 7.0 |
| Operating system | Linux mint |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working