alexandrebulete/ddd-doctrine-bridge
最新稳定版本:1.0.0
Composer 安装命令:
composer require alexandrebulete/ddd-doctrine-bridge
包简介
Doctrine ORM bridge for DDD Foundation - Pure PHP, no framework dependency
README 文档
README
Doctrine ORM bridge for DDD Foundation. This package provides repository and paginator implementations using Doctrine, plus custom DBAL types for Value Objects.
Pure PHP - No framework dependency. Use with any PHP framework.
Installation
composer require alexandrebulete/ddd-doctrine-bridge
For Symfony integration, also install:
composer require alexandrebulete/ddd-doctrine-bundle
Structure
src/
├── DoctrineRepository.php
├── DoctrinePaginator.php
└── Type/
├── BaseType.php
├── GuidType.php
├── TextType.php
├── VarcharType.php
└── Convertor/
├── AsIdentifierConvertor.php
└── AsStringConvertor.php
Usage
DoctrineRepository
use AlexandreBulete\DddDoctrineBridge\DoctrineRepository; use App\Post\Domain\Entity\Post; class DoctrinePostRepository extends DoctrineRepository { public function __construct(EntityManagerInterface $em) { parent::__construct($em, Post::class, 'p'); } public function findById(IdentifierVO $id): ?Post { return $this->query() ->andWhere('p.id = :id') ->setParameter('id', $id->toString()) ->getQuery() ->getOneOrNullResult(); } }
Custom Doctrine Types
Create custom Doctrine types for your Value Objects:
use AlexandreBulete\DddDoctrineBridge\Type\GuidType; use App\Post\Domain\ValueObject\PostId; class PostIdType extends GuidType { protected string $name = 'post_id'; protected string $voClass = PostId::class; }
Available Base Types
- GuidType: For UUID/ULID identifier value objects
- VarcharType: For string value objects (VARCHAR)
- TextType: For string value objects (TEXT/CLOB)
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-12-20