Skip to content

Commit

Permalink
Merge pull request #91 from bildvitta/develop
Browse files Browse the repository at this point in the history
Separating the import of unit and unit accessories
  • Loading branch information
zerossB authored Aug 7, 2024
2 parents bf0665b + 17b605c commit 8b996a2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ public function handle()
case 'units':
$this->units();
break;
case 'units_accessories':
$this->units_accessories();
break;
case 'documents':
$this->documents();
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ public function handle()

$selectLimit = 500;
if ($optionSelect = $this->option('select')) {
$selectLimit = (int) $optionSelect;
$selectLimit = (int)$optionSelect;
}

$offset = 0;
if ($optionOffset = $this->option('offset')) {
$offset = (int) $optionOffset;
$offset = (int)$optionOffset;
}

$tableIndex = 0;
if ($optionTableIndex = $this->option('table')) {
$tableIndex = (int) $optionTableIndex;
$tableIndex = (int)$optionTableIndex;
}

$worker = new Worker();
Expand Down Expand Up @@ -141,6 +141,7 @@ private function getTables(): array
}
if ($this->configHas('units')) {
$tables[] = 'units';
$tables[] = 'units_accessories';
}
if ($this->configHas('documents')) {
$tables[] = 'documents';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,11 +510,14 @@ private function units(): void
],
['created_at', 'updated_at', 'deleted_at', 'ready_to_live_in']
);
}

private function units_accessories()
{
$accessories = $this->getDatabase()->table('real_estate_development_accessory_unit as redau')
->leftJoin('units as un', 'redau.unit_id', '=', 'un.id')
->leftJoin('real_estate_development_accessories as reda', 'redau.accessory_id', '=', 'reda.id')
->select('un.uuid as unit_uuid', 'reda.uuid as accessory_uuid');
->select('reda.uuid as foreign_uuid', 'un.uuid as model_uuid');

$this->syncRelated(
$accessories,
Expand Down

0 comments on commit 8b996a2

Please sign in to comment.