定制 alexandrebulete/ddd-doctrine-bridge 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-20