-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added getAggregateRootMappingsForProjectionId See merge request fluxlabs/flux-eco/projection!3
- Loading branch information
Showing
9 changed files
with
134 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
# CHANGELOG | ||
|
||
## [1.1.0] | ||
* added getAggregateRootMappingsForProjectionId | ||
|
||
## [1.0.0] | ||
* added functional usage | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace fluxProjection; | ||
|
||
use FluxEco\{Projection, Projection\Adapters}; | ||
|
||
/** @return Adapters\AggregateRoot\AggregateRootMappingAdapter[] */ | ||
function getAggregateRootMappingsForProjectionId(string $projectionId): array | ||
{ | ||
return Projection\Api::newFromEnv()->getAggregateRootMappingsForProjectionId($projectionId); | ||
} |
68 changes: 68 additions & 0 deletions
68
src/Adapters/AggregateRoot/AggregateRootMappingAdapter.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
|
||
|
||
namespace FluxEco\Projection\Adapters\AggregateRoot; | ||
|
||
use FluxEco\Projection\{Core\Domain}; | ||
|
||
class AggregateRootMappingAdapter | ||
{ | ||
private string $projectionName; | ||
private string $projectionId; | ||
private string $aggregateName; | ||
private string $aggregateId; | ||
private ?string $externalId; | ||
|
||
private function __construct( | ||
string $projectionName, | ||
string $projectionId, | ||
string $aggregateName, | ||
string $aggregateId, | ||
?string $externalId | ||
) | ||
{ | ||
$this->projectionName = $projectionName; | ||
$this->projectionId = $projectionId; | ||
$this->aggregateName = $aggregateName; | ||
$this->aggregateId = $aggregateId; | ||
$this->externalId = $externalId; | ||
} | ||
|
||
public static function fromDomain( | ||
Domain\Models\AggregateRootMapping $aggregateRootMapping | ||
): self | ||
{ | ||
return new self( | ||
$aggregateRootMapping->getProjectionName(), | ||
$aggregateRootMapping->getProjectionId(), | ||
$aggregateRootMapping->getAggregateName(), | ||
$aggregateRootMapping->getAggregateId(), | ||
$aggregateRootMapping->getExternalId() | ||
); | ||
} | ||
|
||
final public function getAggregateName(): string | ||
{ | ||
return $this->aggregateName; | ||
} | ||
|
||
final public function getAggregateId(): string | ||
{ | ||
return $this->aggregateId; | ||
} | ||
|
||
public function getProjectionName() : string | ||
{ | ||
return $this->projectionName; | ||
} | ||
|
||
public function getProjectionId() : string | ||
{ | ||
return $this->projectionId; | ||
} | ||
|
||
public function getExternalId() : ?string | ||
{ | ||
return $this->externalId; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters