From a2f928349bce4b67c5a18f19933ccb194a2ce531 Mon Sep 17 00:00:00 2001 From: HorstOeko Date: Thu, 5 Oct 2023 05:57:03 +0200 Subject: [PATCH] Added getDocumentCodeType to ObjectHelper, Use in Builder --- src/OrderDocumentBuilder.php | 2 +- src/OrderObjectHelper.php | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/OrderDocumentBuilder.php b/src/OrderDocumentBuilder.php index e4a5eed..09ee609 100644 --- a/src/OrderDocumentBuilder.php +++ b/src/OrderDocumentBuilder.php @@ -247,7 +247,7 @@ public function setDocumentName(string $documentName): OrderDocumentBuilder */ public function setDocumentTypeCode(string $documentTypeCode): OrderDocumentBuilder { - $this->objectHelper->tryCall($this->orderObject->getExchangedDocument(), "setTypeCode", $this->objectHelper->getCodeType($documentTypeCode)); + $this->objectHelper->tryCall($this->orderObject->getExchangedDocument(), "setTypeCode", $this->objectHelper->getDocumentCodeType($documentTypeCode)); return $this; } diff --git a/src/OrderObjectHelper.php b/src/OrderObjectHelper.php index 8511047..16a9140 100644 --- a/src/OrderObjectHelper.php +++ b/src/OrderObjectHelper.php @@ -66,6 +66,21 @@ public function __construct(int $profile) $this->profiledef = OrderProfiles::PROFILEDEF[$profile]; } + /** + * Creates an instance of DocumentCodeType + * + * @param string|null $value + * @return object|null + */ + public function getDocumentCodeType(?string $value = null): ?object + { + if (self::isAllNullOrEmpty(func_get_args())) { + return null; + } + + return $this->createClassInstance('qdt\DocumentCodeType', $value); + } + /** * Creates an instance of IDType *