diff --git a/Admin/Installer.php b/Admin/Installer.php index fcc36ab..1ab405b 100755 --- a/Admin/Installer.php +++ b/Admin/Installer.php @@ -35,11 +35,12 @@ final class Installer extends InstallerAbstract /** * {@inheritdoc} */ + /* public static function install(DatabasePool $dbPool, ModuleInfo $info, SettingsInterface $cfgHandler) : void { parent::install($dbPool, $info, $cfgHandler); - /* + $interfaces = Directory::list(__DIR__ . '/../Interfaces', '.*interface\.json', true); foreach ($interfaces as $interface) { @@ -47,6 +48,7 @@ final class Installer extends InstallerAbstract $exchange->load(); InterfaceManagerMapper::create($exchange); - }*/ + } } + */ } diff --git a/Interfaces/GSD/Importer.php b/Interfaces/GSD/Importer.php index bf91740..8652191 100755 --- a/Interfaces/GSD/Importer.php +++ b/Interfaces/GSD/Importer.php @@ -62,6 +62,7 @@ use phpOMS\Localization\ISO639x1Enum; use phpOMS\Message\RequestAbstract; use phpOMS\System\File\Local\Directory; use phpOMS\Utils\IO\Zip\Zip; +use Modules\ItemManagement\Models\ItemAttributeValue; /** * GSD import class @@ -79,7 +80,7 @@ final class Importer extends ImporterAbstract * @var ConnectionAbstract * @since 1.0.0 */ - private ?ConnectionAbstract $remote = null; + private ConnectionAbstract $remote; /** * Account @@ -412,9 +413,9 @@ final class Importer extends ImporterAbstract /** * Import articles * - * @param \DateTime $start Start time (inclusive) - * @param \DateTime $end End time (inclusive) - * @param array $images Article images + * @param \DateTime $start Start time (inclusive) + * @param \DateTime $end End time (inclusive) + * @param array $files Article images * * @return void * @@ -456,6 +457,8 @@ final class Importer extends ImporterAbstract $images = \array_merge($jpg, $png); $images = \array_diff($images, $imagesOld); + /** @var string[] $images */ + /** @var string $image */ foreach ($images as $image) { $number = (int) \explode('.', $image)[0]; @@ -465,7 +468,7 @@ final class Importer extends ImporterAbstract $media[$number]->setPath('/Modules/Media/Files/Modules/ItemManagement/Articles/Images/' . $image); $media[$number]->setVirtualPath('/Modules/ItemManagement/Articles/Images'); $media[$number]->setExtension(\explode('.', $image)[1]); - $media[$number]->setSize(\filesize($imagePath . '/' . $image)); + $media[$number]->setSize((int) \filesize($imagePath . '/' . $image)); $media[$number]->setCreatedBy(new NullAccount($this->account)); MediaMapper::create($media[$number]); @@ -613,7 +616,7 @@ final class Importer extends ImporterAbstract /** * Create and get item attribute values * - * @param ItemAttributeType[] $itemAttributeType Attribute types + * @param ItemAttributeType[] $itemAttrType Attribute types * * @return ItemAttributeValue[] * diff --git a/Interfaces/GSD/Model/GSDCostCenter.php b/Interfaces/GSD/Model/GSDCostCenter.php index d70704d..d1ee33a 100755 --- a/Interfaces/GSD/Model/GSDCostCenter.php +++ b/Interfaces/GSD/Model/GSDCostCenter.php @@ -81,7 +81,7 @@ class GSDCostCenter implements \JsonSerializable */ public function getCreatedAt() : \DateTimeImmutable { - return $this->createdAt ?? new \DateTime(); + return $this->createdAt ?? new \DateTimeImmutable(); } /** diff --git a/Interfaces/GSD/Model/GSDCostObject.php b/Interfaces/GSD/Model/GSDCostObject.php index eb5852c..80da2a3 100755 --- a/Interfaces/GSD/Model/GSDCostObject.php +++ b/Interfaces/GSD/Model/GSDCostObject.php @@ -81,7 +81,7 @@ class GSDCostObject implements \JsonSerializable */ public function getCreatedAt() : \DateTimeImmutable { - return $this->createdAt ?? new \DateTime(); + return $this->createdAt ?? new \DateTimeImmutable(); } /** diff --git a/Interfaces/GSD/Model/GSDCustomer.php b/Interfaces/GSD/Model/GSDCustomer.php index 48ddccf..ddfdabd 100755 --- a/Interfaces/GSD/Model/GSDCustomer.php +++ b/Interfaces/GSD/Model/GSDCustomer.php @@ -24,12 +24,6 @@ namespace Modules\Exchange\Interfaces\GSD\Model; */ class GSDCustomer { - /** - * ID. - * - * @var int - * @since 1.0.0 - */ public int $id = 0; public int $createdBy = 0; diff --git a/Interfaces/GSD/Model/GSDCustomerMapper.php b/Interfaces/GSD/Model/GSDCustomerMapper.php index 205442f..41dd073 100755 --- a/Interfaces/GSD/Model/GSDCustomerMapper.php +++ b/Interfaces/GSD/Model/GSDCustomerMapper.php @@ -65,6 +65,12 @@ final class GSDCustomerMapper extends DataMapperAbstract '_Partnernummer6' => ['name' => '_Partnernummer6', 'type' => 'string', 'internal' => 'partner/6'], ]; + /** + * Has one relation. + * + * @var array + * @since 1.0.0 + */ protected static array $ownsOne = [ 'addr' => [ 'mapper' => GSDAddressMapper::class, diff --git a/Interfaces/GSD/Model/GSDSupplier.php b/Interfaces/GSD/Model/GSDSupplier.php index 8a9c387..e1745f3 100755 --- a/Interfaces/GSD/Model/GSDSupplier.php +++ b/Interfaces/GSD/Model/GSDSupplier.php @@ -26,7 +26,7 @@ class GSDSupplier { public int $id = 0; - public $createdBy = 0; + public int $createdBy = 0; public \DateTimeImmutable $createdAt; diff --git a/Interfaces/GSD/Model/GSDSupplierMapper.php b/Interfaces/GSD/Model/GSDSupplierMapper.php index 1c1085c..e413c23 100755 --- a/Interfaces/GSD/Model/GSDSupplierMapper.php +++ b/Interfaces/GSD/Model/GSDSupplierMapper.php @@ -45,6 +45,12 @@ final class GSDSupplierMapper extends DataMapperAbstract 'AdressId' => ['name' => 'AdressId', 'type' => 'int', 'internal' => 'addr'], ]; + /** + * Has one relation. + * + * @var array + * @since 1.0.0 + */ protected static array $ownsOne = [ 'addr' => [ 'mapper' => GSDAddressMapper::class, diff --git a/Models/ExchangeLog.php b/Models/ExchangeLog.php index aa0b7fe..8acbad0 100644 --- a/Models/ExchangeLog.php +++ b/Models/ExchangeLog.php @@ -61,7 +61,7 @@ class ExchangeLog implements \JsonSerializable, ArrayableInterface /** * Date type. * - * @var int + * @var \DateTimeImmutable * @since 1.0.0 */ private \DateTimeImmutable $createdAt; @@ -167,7 +167,7 @@ class ExchangeLog implements \JsonSerializable, ArrayableInterface /** * Get created at. * - * @return DateTimeImmutable + * @return \DateTimeImmutable * * @since 1.0.0 */ diff --git a/Models/ImporterAbstract.php b/Models/ImporterAbstract.php index 5f95a65..7e078a9 100755 --- a/Models/ImporterAbstract.php +++ b/Models/ImporterAbstract.php @@ -14,7 +14,7 @@ declare(strict_types=1); namespace Modules\Exchange\Models; -use phpOMS\DataStorage\Database\Connection\ConnectionInterface; +use phpOMS\DataStorage\Database\Connection\ConnectionAbstract; use phpOMS\Message\RequestAbstract; /** @@ -30,19 +30,19 @@ abstract class ImporterAbstract /** * Database connection. * - * @var ConnectionInterface + * @var ConnectionAbstract * @since 1.0.0 */ - protected $local = null; + protected ConnectionAbstract $local; /** * Constructor * - * @param ConnectionInterface $local Database connection + * @param ConnectionAbstract $local Database connection * * @since 1.0.0 */ - public function __construct(ConnectionInterface $local) + public function __construct(ConnectionAbstract $local) { $this->local = $local; }