-
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.
- Loading branch information
1 parent
a1da495
commit 358718b
Showing
155 changed files
with
2,293 additions
and
184 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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PBaszak\UltraMapper\Blueprint\Domain; | ||
|
||
use PBaszak\UltraMapper\Blueprint\Domain\Events\BlueprintCreated; | ||
use PBaszak\UltraMapper\Blueprint\Domain\Identity\BlueprintId; | ||
use PBaszak\UltraMapper\Shared\Domain\ObjectTypes\AggregateRoot; | ||
|
||
final class Blueprint extends AggregateRoot | ||
{ | ||
private function __construct( | ||
private BlueprintId $id, | ||
/** @var array<class-string, ClassBlueprint> */ | ||
private array $classBlueprints = [], | ||
) { | ||
} | ||
|
||
/** | ||
* @param BlueprintId $id | ||
* @param array<class-string, ClassBlueprint> $classBlueprints | ||
*/ | ||
public static function create(BlueprintId $id, array $classBlueprints): static | ||
{ | ||
$blueprint = new static($id, $classBlueprints); | ||
|
||
$blueprint->raise( | ||
new BlueprintCreated($id) | ||
); | ||
|
||
return $blueprint; | ||
} | ||
|
||
/** | ||
* @param BlueprintId $id | ||
* @param array<class-string, ClassBlueprint> $classBlueprints | ||
*/ | ||
public static function recreate(BlueprintId $id, array $classBlueprints): static | ||
{ | ||
return new static($id, $classBlueprints); | ||
} | ||
|
||
public function id(): BlueprintId | ||
{ | ||
return $this->id; | ||
} | ||
|
||
/** | ||
* @return array<class-string, ClassBlueprint> | ||
*/ | ||
public function classBlueprints(): array | ||
{ | ||
return $this->classBlueprints; | ||
} | ||
} |
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,56 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PBaszak\UltraMapper\Blueprint\Domain\Entities; | ||
|
||
use PBaszak\UltraMapper\Blueprint\Domain\Events\BlueprintCreated; | ||
use PBaszak\UltraMapper\Blueprint\Domain\Identity\BlueprintId; | ||
use PBaszak\UltraMapper\Shared\Domain\ObjectTypes\AggregateRoot; | ||
|
||
final class ClassBlueprint extends AggregateRoot | ||
{ | ||
private function __construct( | ||
private BlueprintId $id, | ||
/** @var array<string, PropertyBlueprint> */ | ||
private array $propertyBlueprints = [], | ||
) { | ||
} | ||
|
||
/** | ||
* @param BlueprintId $id | ||
* @param array<string, PropertyBlueprint> $propertyBlueprints | ||
*/ | ||
public static function create(BlueprintId $id, array $propertyBlueprints): static | ||
{ | ||
$blueprint = new static($id, $propertyBlueprints); | ||
|
||
$blueprint->raise( | ||
new BlueprintCreated($id) | ||
); | ||
|
||
return $blueprint; | ||
} | ||
|
||
/** | ||
* @param BlueprintId $id | ||
* @param array<string, PropertyBlueprint> $propertyBlueprints | ||
*/ | ||
public static function recreate(BlueprintId $id, array $propertyBlueprints): static | ||
{ | ||
return new static($id, $propertyBlueprints); | ||
} | ||
|
||
public function id(): BlueprintId | ||
{ | ||
return $this->id; | ||
} | ||
|
||
/** | ||
* @return array<string, PropertyBlueprint> | ||
*/ | ||
public function propertyBlueprints(): array | ||
{ | ||
return $this->propertyBlueprints; | ||
} | ||
} |
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,38 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PBaszak\UltraMapper\Blueprint\Domain\Entities; | ||
|
||
use PBaszak\UltraMapper\Blueprint\Domain\Events\BlueprintCreated; | ||
use PBaszak\UltraMapper\Blueprint\Domain\Identity\BlueprintId; | ||
use PBaszak\UltraMapper\Shared\Domain\ObjectTypes\AggregateRoot; | ||
|
||
final class PropertyBlueprint extends AggregateRoot | ||
{ | ||
private function __construct( | ||
private BlueprintId $id, | ||
) { | ||
} | ||
|
||
public static function create(BlueprintId $id): static | ||
{ | ||
$blueprint = new static($id); | ||
|
||
$blueprint->raise( | ||
new BlueprintCreated($id) | ||
); | ||
|
||
return $blueprint; | ||
} | ||
|
||
public static function recreate(BlueprintId $id): static | ||
{ | ||
return new static($id); | ||
} | ||
|
||
public function id(): BlueprintId | ||
{ | ||
return $this->id; | ||
} | ||
} |
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,20 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PBaszak\UltraMapper\Blueprint\Domain\Events; | ||
|
||
use PBaszak\UltraMapper\Shared\Domain\Identity\Identifier; | ||
use PBaszak\UltraMapper\Shared\Domain\ObjectTypes\Event; | ||
|
||
final readonly class BlueprintCreated extends Event | ||
{ | ||
public const EVENT_NAME = 'blueprint_created'; | ||
public const EVENT_VERSION = 1; | ||
|
||
public function __construct( | ||
public readonly Identifier $id | ||
) { | ||
parent::__construct($id, self::EVENT_NAME, self::EVENT_VERSION); | ||
} | ||
} |
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 | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PBaszak\UltraMapper\Blueprint\Domain\Identity; | ||
|
||
use PBaszak\UltraMapper\Shared\Domain\Identity\Identifier; | ||
|
||
final class BlueprintId extends Identifier | ||
{ | ||
} |
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,38 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PBaszak\UltraMapper\Build\Domain; | ||
|
||
use PBaszak\UltraMapper\Build\Domain\Events\BuildCreated; | ||
use PBaszak\UltraMapper\Build\Domain\Identity\BuildId; | ||
use PBaszak\UltraMapper\Shared\Domain\ObjectTypes\AggregateRoot; | ||
|
||
final class Build extends AggregateRoot | ||
{ | ||
private function __construct( | ||
private BuildId $id, | ||
) { | ||
} | ||
|
||
public static function create(BuildId $id): static | ||
{ | ||
$build = new static($id); | ||
|
||
$build->raise( | ||
new BuildCreated($id) | ||
); | ||
|
||
return $build; | ||
} | ||
|
||
public static function recreate(BuildId $id): static | ||
{ | ||
return new static($id); | ||
} | ||
|
||
public function id(): BuildId | ||
{ | ||
return $this->id; | ||
} | ||
} |
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,20 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PBaszak\UltraMapper\Build\Domain\Events; | ||
|
||
use PBaszak\UltraMapper\Shared\Domain\Identity\Identifier; | ||
use PBaszak\UltraMapper\Shared\Domain\ObjectTypes\Event; | ||
|
||
final readonly class BuildCreated extends Event | ||
{ | ||
public const EVENT_NAME = 'build_created'; | ||
public const EVENT_VERSION = 1; | ||
|
||
public function __construct( | ||
public readonly Identifier $id | ||
) { | ||
parent::__construct($id, self::EVENT_NAME, self::EVENT_VERSION); | ||
} | ||
} |
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 | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PBaszak\UltraMapper\Build\Domain\Identity; | ||
|
||
use PBaszak\UltraMapper\Shared\Domain\Identity\Identifier; | ||
|
||
final class BuildId extends Identifier | ||
{ | ||
} |
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,20 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PBaszak\UltraMapper\Mapper\Domain\Events; | ||
|
||
use PBaszak\UltraMapper\Shared\Domain\Identity\Identifier; | ||
use PBaszak\UltraMapper\Shared\Domain\ObjectTypes\Event; | ||
|
||
final readonly class MapperCreated extends Event | ||
{ | ||
public const EVENT_NAME = 'mapper_created'; | ||
public const EVENT_VERSION = 1; | ||
|
||
public function __construct( | ||
public readonly Identifier $id | ||
) { | ||
parent::__construct($id, self::EVENT_NAME, self::EVENT_VERSION); | ||
} | ||
} |
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 | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PBaszak\UltraMapper\Mapper\Domain\Identity; | ||
|
||
use PBaszak\UltraMapper\Shared\Domain\Identity\Identifier; | ||
|
||
final class MapperId extends Identifier | ||
{ | ||
} |
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,38 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PBaszak\UltraMapper\Mapper\Domain; | ||
|
||
use PBaszak\UltraMapper\Mapper\Domain\Events\MapperCreated; | ||
use PBaszak\UltraMapper\Mapper\Domain\Identity\MapperId; | ||
use PBaszak\UltraMapper\Shared\Domain\ObjectTypes\AggregateRoot; | ||
|
||
final class Mapper extends AggregateRoot | ||
{ | ||
private function __construct( | ||
private MapperId $id, | ||
) { | ||
} | ||
|
||
public static function create(MapperId $id): static | ||
{ | ||
$mapper = new static($id); | ||
|
||
$mapper->raise( | ||
new MapperCreated($id) | ||
); | ||
|
||
return $mapper; | ||
} | ||
|
||
public static function recreate(MapperId $id): static | ||
{ | ||
return new static($id); | ||
} | ||
|
||
public function id(): MapperId | ||
{ | ||
return $this->id; | ||
} | ||
} |
Oops, something went wrong.