Fixed: return null when region_id is nicht-DE

This commit is contained in:
philipp lang 2021-05-14 18:38:47 +02:00
parent a34b16bd70
commit 920ea7a34e
3 changed files with 12 additions and 3 deletions

View File

@ -4,11 +4,16 @@ namespace Zoomyboy\LaravelNami;
use Illuminate\Support\Arr;
use Illuminate\Database\Eloquent\Model;
use Zoomyboy\LaravelNami\Nullable;
class Region extends Model {
class Region extends Model implements Nullable {
protected $guarded = [];
public static function getNullValue() {
return 23;
}
public static function fromNami($item) {
return new self([
'id' => $item['id'],
@ -16,4 +21,8 @@ class Region extends Model {
]);
}
public function getIsNullAttribute() {
return $this->id == self::getNullValue();
}
}

View File

@ -40,7 +40,7 @@ class PullMemberTest extends TestCase
'mitgliedsnr' => ['mitgliedsnr', [12345, null]],
'updated_at' => ['updated_at', ['2020-06-28 02:15:24', '2015-02-03 15:20:07']],
'send_newspaper' => ['send_newspaper', [true, false]],
'region_id' => ['region_id', [10, 11]],
'region_id' => ['region_id', [10, null]],
'country_id' => ['country_id', [100, 101]],
'fee_id' => ['fee_id', [1, 15]],
];

View File

@ -61,7 +61,7 @@
"ort": "Köln",
"ersteUntergliederungId": null,
"wiederverwendenFlag": false,
"regionId": 11,
"regionId": null,
"geburtsDatum": "1984-01-17 00:00:00",
"stufe": null,
"genericField1": null,