Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Miss #22

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open

Miss #22

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"require": {
"php": ">=8.0",
"ext-zip": "*",
"doctrine/annotations": "^1.0",
"doctrine/annotations": "^2.0",
"doctrine/doctrine-bundle": "^2.0",
"guzzlehttp/guzzle": "^6.0 || ^7.0",
"symfony/console": "^5.4 || ^6.0"
Expand Down
16 changes: 11 additions & 5 deletions src/Command/ImportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function getImporters(): array
/**
*
*/
protected function configure()
protected function configure(): void
{
$commandLine = $this
->setName('bordeux:geoname:import')
Expand All @@ -58,9 +58,15 @@ protected function configure()
"Download dir",
sys_get_temp_dir()
);

$commandLine->addOption(
"only",
null,
InputOption::VALUE_REQUIRED,
"Importing only importName, use import-option-name (ex: alternate-names)",
false
);
foreach ($this->importers as $importer) {
$commandLine = $commandLine->addOption(
$commandLine->addOption(
$importer->getOptionName(),
null,
InputOption::VALUE_OPTIONAL,
Expand All @@ -85,11 +91,11 @@ protected function configure()
protected function execute(InputInterface $input, OutputInterface $output)
{
$downloadDir = $input->getOption('download-dir');

$only = $input->getOption('only');
foreach ($this->importers as $importer) {
$value = $input->getOption($importer->getOptionName());
$skip = $input->getOption("skip-" . $importer->getOptionName());
if (empty($value) || $skip) {
if (empty($value) || $skip || (!empty($only) && $only !== $importer->getOptionName())) {
$output->writeln("\nSkipping importing {$importer->getName()}");
continue;
}
Expand Down
23 changes: 23 additions & 0 deletions src/Entity/AlternateName.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ class AlternateName implements Stringable
*/
protected $value;

/**
* @var string
*
* @ORM\Column(name="prefered", type="string", length=1, nullable=true)
*/
protected $prefered;

/**
*
* @return int
Expand Down Expand Up @@ -113,7 +120,23 @@ public function setValue(string $value): self
$this->value = $value;
return $this;
}
/**
* Get the value of prefered
*/
public function getPrefered(): string
{
return $this->prefered;
}

/**
* Set the value of prefered
*/
public function setPrefered(string $prefered): self
{
$this->prefered = $prefered;
return $this;
}

/**
* @return string
*/
Expand Down
25 changes: 23 additions & 2 deletions src/Entity/Country.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,13 @@ class Country implements Stringable
* @ORM\Column(name="languages", type="json", nullable=true)
*/
protected ?array $languages;

/**
* @var GeoName
*
* @ORM\ManyToOne(targetEntity="Bordeux\Bundle\GeoNameBundle\Entity\GeoName")
* @ORM\JoinColumn(name="continent_id", referencedColumnName="id", nullable=true)
*/
protected ?GeoName $continent;
/**
* @var GeoName
*
Expand Down Expand Up @@ -450,7 +456,22 @@ public function setGeoName(?GeoName $geoName): self
$this->geoName = $geoName;
return $this;
}

/**
* @param GeoName|null $geoName
* @return $this
*/
public function setContinent(?GeoName $geoName): self
{
$this->continent = $geoName;
return $this;
}
/**
* @return GeoName|null
*/
public function getContinent(): ?GeoName
{
return $this->continent;
}
/**
* @return string
*/
Expand Down
Loading