29 lines
788 B
PHP
29 lines
788 B
PHP
#!/usr/bin/php
|
|
<?php
|
|
|
|
//require 'vendor/autoload.php';
|
|
require("../../config/config.php");
|
|
|
|
define('FRONKDB_SQLDEBUG',false);
|
|
error_reporting(E_ALL & ~(E_NOTICE | E_STRICT | E_DEPRECATED));
|
|
|
|
require_once(LIBDIR."/mvcfronk/mfRouter/mfRouter.php");
|
|
require_once(LIBDIR."/mvcfronk/mfBase/mfBaseModel.php");
|
|
require_once(LIBDIR."/mvcfronk/mfBase/mfBaseController.php");
|
|
|
|
$i = 0;
|
|
|
|
foreach(ADBWohneinheitModel::getAll() as $unit) {
|
|
$hausnummer = new ADBHausnummer($unit->hausnummer_id);
|
|
if($hausnummer->id) {
|
|
$unit_count = ADBWohneinheitModel::count(['hausnummer_id' => $unit->hausnummer_id]);
|
|
$hausnummer->unit_count = $unit_count;
|
|
if(!$hausnummer->save()) {
|
|
echo "error saving hausnummer ".$hausnummer->id."\n";
|
|
}
|
|
$i++;
|
|
}
|
|
}
|
|
|
|
echo "Updated $i Wohneinheiten\n";
|