3 declare(strict_types=1);
25 use DateTimeImmutable;
188 private static $discriminatorClasses = [
189 'Company' => CompanyModel::class,
190 'Division' => DivisionModel::class,
207 ?
string $name =
null,
258 if (is_null($this->
id)) {
260 $data = $this->
raw(self::FIELD_ID);
261 if (is_null($data)) {
264 $this->
id = (string) $data;
278 if (is_null($this->version)) {
280 $data = $this->
raw(self::FIELD_VERSION);
281 if (is_null($data)) {
284 $this->version = (int) $data;
298 if (is_null($this->createdAt)) {
300 $data = $this->
raw(self::FIELD_CREATED_AT);
301 if (is_null($data)) {
305 if (
false === $data) {
308 $this->createdAt = $data;
322 if (is_null($this->lastModifiedAt)) {
324 $data = $this->
raw(self::FIELD_LAST_MODIFIED_AT);
325 if (is_null($data)) {
329 if (
false === $data) {
332 $this->lastModifiedAt = $data;
346 if (is_null($this->lastModifiedBy)) {
348 $data = $this->
raw(self::FIELD_LAST_MODIFIED_BY);
349 if (is_null($data)) {
367 if (is_null($this->createdBy)) {
369 $data = $this->
raw(self::FIELD_CREATED_BY);
370 if (is_null($data)) {
388 if (is_null($this->key)) {
390 $data = $this->
raw(self::FIELD_KEY);
391 if (is_null($data)) {
394 $this->key = (string) $data;
408 if (is_null($this->status)) {
410 $data = $this->
raw(self::FIELD_STATUS);
411 if (is_null($data)) {
414 $this->status = (string) $data;
430 if (is_null($this->stores)) {
432 $data = $this->
raw(self::FIELD_STORES);
433 if (is_null($data)) {
450 if (is_null($this->storeMode)) {
452 $data = $this->
raw(self::FIELD_STORE_MODE);
453 if (is_null($data)) {
456 $this->storeMode = (string) $data;
470 if (is_null($this->unitType)) {
472 $data = $this->
raw(self::FIELD_UNIT_TYPE);
473 if (is_null($data)) {
476 $this->unitType = (string) $data;
490 if (is_null($this->name)) {
492 $data = $this->
raw(self::FIELD_NAME);
493 if (is_null($data)) {
496 $this->name = (string) $data;
510 if (is_null($this->contactEmail)) {
512 $data = $this->
raw(self::FIELD_CONTACT_EMAIL);
513 if (is_null($data)) {
516 $this->contactEmail = (string) $data;
530 if (is_null($this->custom)) {
532 $data = $this->
raw(self::FIELD_CUSTOM);
533 if (is_null($data)) {
551 if (is_null($this->addresses)) {
553 $data = $this->
raw(self::FIELD_ADDRESSES);
554 if (is_null($data)) {
571 if (is_null($this->shippingAddressIds)) {
573 $data = $this->
raw(self::FIELD_SHIPPING_ADDRESS_IDS);
574 if (is_null($data)) {
577 $this->shippingAddressIds = $data;
591 if (is_null($this->defaultShippingAddressId)) {
593 $data = $this->
raw(self::FIELD_DEFAULT_SHIPPING_ADDRESS_ID);
594 if (is_null($data)) {
597 $this->defaultShippingAddressId = (string) $data;
611 if (is_null($this->billingAddressIds)) {
613 $data = $this->
raw(self::FIELD_BILLING_ADDRESS_IDS);
614 if (is_null($data)) {
617 $this->billingAddressIds = $data;
631 if (is_null($this->defaultBillingAddressId)) {
633 $data = $this->
raw(self::FIELD_DEFAULT_BILLING_ADDRESS_ID);
634 if (is_null($data)) {
637 $this->defaultBillingAddressId = (string) $data;
651 if (is_null($this->associateMode)) {
653 $data = $this->
raw(self::FIELD_ASSOCIATE_MODE);
654 if (is_null($data)) {
657 $this->associateMode = (string) $data;
671 if (is_null($this->associates)) {
673 $data = $this->
raw(self::FIELD_ASSOCIATES);
674 if (is_null($data)) {
691 if (is_null($this->inheritedAssociates)) {
693 $data = $this->
raw(self::FIELD_INHERITED_ASSOCIATES);
694 if (is_null($data)) {
711 if (is_null($this->parentUnit)) {
713 $data = $this->
raw(self::FIELD_PARENT_UNIT);
714 if (is_null($data)) {
732 if (is_null($this->topLevelUnit)) {
734 $data = $this->
raw(self::FIELD_TOP_LEVEL_UNIT);
735 if (is_null($data)) {
754 if (is_null($this->approvalRuleMode)) {
756 $data = $this->
raw(self::FIELD_APPROVAL_RULE_MODE);
757 if (is_null($data)) {
760 $this->approvalRuleMode = (string) $data;
960 #[\ReturnTypeWillChange]
971 return (
object) $data;
981 if (is_object($value) && isset($value->$fieldName)) {
983 $discriminatorValue = $value->$fieldName;
984 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
985 return self::$discriminatorClasses[$discriminatorValue];
988 if (is_array($value) && isset($value[$fieldName])) {
990 $discriminatorValue = $value[$fieldName];
991 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
992 return self::$discriminatorClasses[$discriminatorValue];
997 $type = BusinessUnitModel::class;