Skip to content

Commit 9bf500c

Browse files
authored
Rename Entity\{Fields,Features}\ to Model\ (#301)
1 parent 8ef1441 commit 9bf500c

48 files changed

Lines changed: 97 additions & 102 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎docs/ddd/entities.md‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@ are provided in the form of PHP [traits].
77

88
Use entity fields to provide _read operations_ for common entity fields. Built-in fields are:
99

10-
- `Msgphp\Domain\Entity\Fields\CreatedAtField`
11-
- `Msgphp\Domain\Entity\Fields\LastUpdatedAtField`
10+
- `Msgphp\Domain\Model\CreatedAtField`
11+
- `Msgphp\Domain\Model\LastUpdatedAtField`
1212

1313
## Entity Features
1414

1515
Use entity features to provide _write operations_ for common entity fields. Built-in features are:
1616

17-
- `MsgPhp\Domain\Entity\Features\CanBeConfirmed`
18-
- `MsgPhp\Domain\Entity\Features\CanBeEnabled`
17+
- `MsgPhp\Domain\Model\CanBeConfirmed`
18+
- `MsgPhp\Domain\Model\CanBeEnabled`
1919

2020
## Basic Example
2121

2222
```php
2323
<?php
2424

25-
use MsgPhp\Domain\Entity\Fields\CreatedAtField;
26-
use MsgPhp\Domain\Entity\Features\CanBeEnabled;
25+
use MsgPhp\Domain\Model\CreatedAtField;
26+
use MsgPhp\Domain\Model\CanBeEnabled;
2727

2828
// --- SETUP ---
2929

‎docs/event-sourcing/events.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ A domain event is bound to `MsgPhp\Domain\Event\DomainEventInterface`. Its purpo
1919
```php
2020
<?php
2121

22-
use MsgPhp\Domain\Entity\Features\CanBeEnabled;
22+
use MsgPhp\Domain\Model\CanBeEnabled;
2323
use MsgPhp\Domain\Event\DomainEventHandlerInterface;
2424
use MsgPhp\Domain\Event\DomainEventHandlerTrait;
2525
use MsgPhp\Domain\Event\EnableEvent;

‎phpstan.neon‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,7 @@ parameters:
4848
- '#Static property MsgPhp\\.+\\Tests\\.+Test::\$bus \(Symfony\\Component\\Messenger\\MessageBusInterface\) does not accept null\.#'
4949
-
5050
message: '#Call to an undefined method object::.+\(\)\.#'
51-
path: *src/*/Tests/Entity/Fields/*Test.php
52-
-
53-
message: '#Call to an undefined method object::.+\(\)\.#'
54-
path: *src/*/Tests/Entity/Features/*Test.php
51+
path: *src/*/Tests/Model/*Test.php
5552
-
5653
message: '#Call to an undefined method object::dispatch\(\)\.#'
5754
path: src/Domain/Tests/Message/MessageDispatchingTraitTest.php

‎src/Domain/Infra/Doctrine/ObjectMappings.php‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44

55
namespace MsgPhp\Domain\Infra\Doctrine;
66

7-
use MsgPhp\Domain\Entity\Features;
8-
use MsgPhp\Domain\Entity\Fields;
7+
use MsgPhp\Domain\Model;
98

109
/**
1110
* @author Roland Franssen <franssen.roland@gmail.com>
@@ -16,7 +15,7 @@ final class ObjectMappings implements ObjectMappingProviderInterface
1615
{
1716
public static function provideObjectMappings(MappingConfig $config): iterable
1817
{
19-
yield Features\CanBeConfirmed::class => [
18+
yield Model\CanBeConfirmed::class => [
2019
'confirmationToken' => [
2120
'type' => 'string',
2221
'unique' => true,
@@ -28,17 +27,17 @@ public static function provideObjectMappings(MappingConfig $config): iterable
2827
'nullable' => true,
2928
],
3029
];
31-
yield Features\CanBeEnabled::class => [
30+
yield Model\CanBeEnabled::class => [
3231
'enabled' => [
3332
'type' => 'boolean',
3433
],
3534
];
36-
yield Fields\CreatedAtField::class => [
35+
yield Model\CreatedAtField::class => [
3736
'createdAt' => [
3837
'type' => 'datetime',
3938
],
4039
];
41-
yield Fields\LastUpdatedAtField::class => [
40+
yield Model\LastUpdatedAtField::class => [
4241
'lastUpdatedAt' => [
4342
'type' => 'datetime',
4443
],

src/Domain/Entity/Features/CanBeConfirmed.php renamed to src/Domain/Model/CanBeConfirmed.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace MsgPhp\Domain\Entity\Features;
5+
namespace MsgPhp\Domain\Model;
66

77
use MsgPhp\Domain\Event\ConfirmEvent;
88

src/Domain/Entity/Features/CanBeEnabled.php renamed to src/Domain/Model/CanBeEnabled.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace MsgPhp\Domain\Entity\Features;
5+
namespace MsgPhp\Domain\Model;
66

77
use MsgPhp\Domain\Event\DisableEvent;
88
use MsgPhp\Domain\Event\EnableEvent;

src/Domain/Entity/Fields/CreatedAtField.php renamed to src/Domain/Model/CreatedAtField.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace MsgPhp\Domain\Entity\Fields;
5+
namespace MsgPhp\Domain\Model;
66

77
/**
88
* @author Roland Franssen <franssen.roland@gmail.com>

src/Domain/Entity/Fields/LastUpdatedAtField.php renamed to src/Domain/Model/LastUpdatedAtField.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace MsgPhp\Domain\Entity\Fields;
5+
namespace MsgPhp\Domain\Model;
66

77
/**
88
* @author Roland Franssen <franssen.roland@gmail.com>

‎src/Domain/Tests/Infra/Doctrine/ObjectMappingsTest.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ final class ObjectMappingsTest extends TestCase
1313
public function testMapping(): void
1414
{
1515
$available = array_flip(array_map(function (string $file): string {
16-
return 'MsgPhp\\Domain\\Entity\\'.basename(\dirname($file)).'\\'.basename($file, '.php');
17-
}, array_merge(glob(\dirname(__DIR__, 3).'/Entity/Features/*.php'), glob(\dirname(__DIR__, 3).'/Entity/Fields/*.php'))));
16+
return 'MsgPhp\\Domain\\Model\\'.basename($file, '.php');
17+
}, glob(\dirname(__DIR__, 3).'/Model/*.php')));
1818
$mappings = ObjectMappings::provideObjectMappings(new MappingConfig([]));
1919
$mappings = array_keys($mappings instanceof \Traversable ? iterator_to_array($mappings) : $mappings);
2020
sort($mappings);

src/Domain/Tests/Entity/Features/CanBeConfirmedTest.php renamed to src/Domain/Tests/Model/CanBeConfirmedTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
declare(strict_types=1);
44

5-
namespace MsgPhp\Domain\Tests\Entity\Features;
5+
namespace MsgPhp\Domain\Tests\Model;
66

7-
use MsgPhp\Domain\Entity\Features\CanBeConfirmed;
87
use MsgPhp\Domain\Event\ConfirmEvent;
8+
use MsgPhp\Domain\Model\CanBeConfirmed;
99
use PHPUnit\Framework\TestCase;
1010

1111
final class CanBeConfirmedTest extends TestCase

0 commit comments

Comments
 (0)