Skip to content

Commit

Permalink
some fixes for the base type, imports are still a bit of a mess
Browse files Browse the repository at this point in the history
  • Loading branch information
dcarbone committed Feb 1, 2025
1 parent 4b86dd2 commit 8544224
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/Version/Definition/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ public function getDirectlyImplementedInterfaces(): array

// dstu1 has its own special type interface
if ($sourceMeta->isDSTU1() && !$this->isPrimitiveOrListType() && !$this->hasPrimitiveOrListParent()) {
if (null === $this->getParentType()) {
if (!$this->hasConcreteParent()) {
$interfaces[PHPFHIR_TYPES_INTERFACE_DSTU1_TYPE] = $coreFiles
->getCoreFileByEntityName(PHPFHIR_TYPES_INTERFACE_DSTU1_TYPE)
->getFullyQualifiedNamespace(false);
Expand Down Expand Up @@ -884,7 +884,7 @@ public function getDirectlyImplementedInterfaces(): array
->getCoreFileByEntityName(PHPFHIR_TYPES_INTERFACE_RESOURCE_TYPE)
->getFullyQualifiedNamespace(false);
}
} else if (!$this->hasParent() && !$sourceMeta->isDSTU1()) {
} else if (!$this->hasParent() && !$sourceMeta->isDSTU1() && !$this->isAbstract()) {
$interfaces[PHPFHIR_TYPES_INTERFACE_ELEMENT_TYPE] = $coreFiles
->getCoreFileByEntityName(PHPFHIR_TYPES_INTERFACE_ELEMENT_TYPE)
->getFullyQualifiedNamespace(false);
Expand Down Expand Up @@ -917,10 +917,10 @@ public function getDirectlyUsedTraits(): array
$parentType = $this->getParentType();
$coreFiles = $this->_version->getConfig()->getCoreFiles();

if (null === $parentType) {
if (!$this->hasConcreteParent()) {
// if this type has no parent(s), try to add all traits

if ($this->isCommentContainer()) {
if ($this->isCommentContainer() && !$this->hasCommentContainerParent()) {
$traits[PHPFHIR_TYPES_TRAIT_COMMENT_CONTAINER] = $coreFiles
->getCoreFileByEntityName(PHPFHIR_TYPES_TRAIT_COMMENT_CONTAINER)
->getFullyQualifiedNamespace(false);
Expand Down
17 changes: 9 additions & 8 deletions template/versions/types/class_default.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,13 @@ public function _getResourceType(): string

/* <?php echo basename(__FILE__) . ':' . __LINE__; ?> */
<?php
echo require_with(
PHPFHIR_TEMPLATE_VERSION_TYPES_VALIDATION_DIR . '/methods.php',
[
'version' => $version,
'type' => $type,
]
);
endif;
echo require_with(
PHPFHIR_TEMPLATE_VERSION_TYPES_VALIDATION_DIR . '/methods.php',
[
'version' => $version,
'type' => $type,
]
);

if ($type->isPrimitiveContainer() || $type->hasPrimitiveContainerParent()) : ?>

Expand Down Expand Up @@ -232,6 +231,8 @@ public function _nonValueFieldDefined(): bool
]
);

endif;

if (null === $type->getParentType()) : ?>

/* <?php echo basename(__FILE__) . ':' . __LINE__; ?> */
Expand Down

0 comments on commit 8544224

Please sign in to comment.