Closed blixit closed 5 years ago
About the first one. Yes, single responsibility has this kind of thing when you want to persist and expose data and decouple a lot. About the second one. Maybe the symfony serializer component can help with this by having the configuration in yaml files in infrastructure so you don't need to deal with it. Something like: https://github.com/jorge07/ddd-playground/blob/master/src/Infrastructure/WalletBundle/Resources/config/serializer/wallet/Model.Wallet.yml Problem is that this intefaces are required by broadway, something I'm not very happy with.
cool ! (about the 1st one) should I close this issue or let it opened ?
... by having the configuration in yaml files in infrastructure ...
This is exactly what i'm trying to not have. I know my code will grow fast so I dont want lose my mind with config files. I'm looking for the best way to reduce maintenance operations. Thanks for your response
I played a little bit with your project the last days and I really like it. I just found 2 anoying points:
Regarding the first issue I know that DDD requires use of interface to avoid coupling between application and infra. So do you plan to add some commands to make it easy to create simple classes automatically ? I mean events, commands/handlers, query/handlers, projectionview, ... Or do you have some tricks to facilitate the transition from REST to ES-CQRS ?
About the 2nd point, I find my own way to avoid to write many lines. I've created a dynamic serializer that only de/serializes required fields. It also comes with many traits and heavy classes. I'm not sure it's the best way, but I saved many useless lines and improved my productivity.
declare(strict_types=1);
namespace App\Domain\SmsBusiness\RecipientApplication\Event;
use App\Domain\Shared\Parts\DynamicSerializer; use App\Domain\Shared\Parts\HasIdentity; use App\Domain\Shared\Parts\HasName; use App\Domain\Shared\Parts\HasOwner; use App\Domain\Shared\Timeable\Timeable; use App\Domain\SmsBusiness\RecipientApplication\ValueObject\ApplicationName; use Broadway\Serializer\Serializable; use DateTime; use Ramsey\Uuid\UuidInterface;
final class RecipientApplicationWasCreated implements Serializable { use Timeable; use HasIdentity; use HasName; use HasOwner;
}
declare(strict_types=1);
namespace App\Domain\Shared\Parts;
use Assert\Assertion; use ReflectionClass; use function call_user_func; use function ucfirst;
class DynamicSerializer { /* @var string[] / private static $serializers = [ 'uuid' => 'serializeUuid', 'name' => 'serializeName', 'ownerId' => 'serializeOwnerId', 'createdAt' => 'serializeCreatedAt', 'updatedAt' => 'serializeUpdatedAt', ];
}