Added buildingType in ADB hausnummer and rimo import
This commit is contained in:
@@ -46,16 +46,14 @@ class ADBWohneinheit extends mfBaseModel {
|
||||
if($hausnummer->netzgebiet_id) {
|
||||
$netzgebiet = new ADBNetzgebiet($hausnummer->netzgebiet_id);
|
||||
if($netzgebiet->id) {
|
||||
/*$netzgebiet->unit_count = ADBWohneinheitModel::count(['netzgebiet_id' => $hausnummer->netzgebiet_id]);
|
||||
$gda_egenschaft = strtolower($hausnummer->gdaeigenschaft);
|
||||
if($gda_egenschaft && array_key_exists($gda_egenschaft, TT_ADB_GDA_TYPES)) {
|
||||
$netzgebiet->{"unit_count_".TT_ADB_GDA_TYPES[$gda_egenschaft]};
|
||||
}*/
|
||||
$unit_count = ADBWohneinheitModel::count(['netzgebiet_id' => $hausnummer->netzgebiet_id]);
|
||||
if($unit_count) {
|
||||
$unit_count_gda = [];
|
||||
foreach(ADBHausnummerModel::search(["netzgebiet_id" => $hausnummer->netzgebiet_id]) as $hausnummer) {
|
||||
$gda_egenschaft = strtolower($hausnummer->gdaeigenschaft);
|
||||
if($hausnummer->rimo_type) {
|
||||
$gda_egenschaft = strtolower($hausnummer->rimo_type);
|
||||
}
|
||||
if($gda_egenschaft && array_key_exists($gda_egenschaft, TT_ADB_GDA_TYPES)) {
|
||||
$type = TT_ADB_GDA_TYPES[$gda_egenschaft];
|
||||
if(!array_key_exists($type, $unit_count_gda)) {
|
||||
@@ -69,6 +67,7 @@ class ADBWohneinheit extends mfBaseModel {
|
||||
}
|
||||
|
||||
}
|
||||
var_dump($netzgebiet);
|
||||
$netzgebiet->unit_count = $unit_count;
|
||||
$netzgebiet->save();
|
||||
}
|
||||
|
||||
31
db/migrations/20241111132029_hausnummer_add_rimo_type.php
Normal file
31
db/migrations/20241111132029_hausnummer_add_rimo_type.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class HausnummerAddRimoType extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
$table = $this->table("Hausnummer");
|
||||
$table->addColumn("rimo_type", "string", ["null" => true, "default" => null, "after" => "rimo_id"]);
|
||||
$table->update();
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
$this->table("Hausnummer")->removeColumn("rimo_type")->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -280,6 +280,13 @@ foreach ($clusters as $cluster_data) {
|
||||
\mfValuecache::singleton()->set("adbhausnummer-save-nesting-level-".$hausnummer->id, 0);
|
||||
}
|
||||
|
||||
if(is_object($building->buildingType) && property_exists($building->buildingType, "userLabel") && $building->buildingType->userLabel) {
|
||||
$hausnummer->rimo_type = strtolower($building->buildingType->userLabel);
|
||||
$hausnummer->save();
|
||||
\mfValuecache::singleton()->set("adbhausnummer-save-nesting-level-".$hausnummer->id, 0);
|
||||
$hausnummer = new \ADBHausnummer($hausnummer_id);
|
||||
}
|
||||
|
||||
|
||||
$last_unit_num = 0;
|
||||
$existing_units = [];
|
||||
|
||||
Reference in New Issue
Block a user