Slide 34
Slide 34 text
final readonly class Node
{
private function __construct(
public ContentSubgraphIdentity $subgraphIdentity,
public NodeAggregateId $nodeAggregateId,
public OriginDimensionSpacePoint $originDimensionSpacePoint,
public NodeAggregateClassification $classification,
public NodeTypeName $nodeTypeName,
public ?NodeType $nodeType,
public PropertyCollection $properties,
public ?NodeName $nodeName,
public Timestamps $timestamps,
) {
}
public static function create(ContentSubgraphIdentity $subgraphIdentity, NodeAggregateId $nodeAggregateId, OriginDimensionSpacePoint
$originDimensionSpacePoint, NodeAggregateClassification $classification, NodeTypeName $nodeTypeName, ?NodeType $nodeType, PropertyCollection
$properties, ?NodeName $nodeName, Timestamps $timestamps): self
{
return new self($subgraphIdentity, $nodeAggregateId, $originDimensionSpacePoint, $classification, $nodeTypeName, $nodeType, $properties,
$nodeName, $timestamps);
}
public function getProperty(string $propertyName): mixed
{
return $this->properties->offsetGet($propertyName);
}
public function hasProperty(string $propertyName): bool
{
return $this->properties->offsetExists($propertyName);
}
public function equals(Node $other): bool
{
return $this->subgraphIdentity->equals($other->subgraphIdentity)
&& $this->nodeAggregateId->equals($other->nodeAggregateId);
}
}