承接 chamber-orchestra/doctrine-extensions-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

chamber-orchestra/doctrine-extensions-bundle

最新稳定版本:v8.0.1

Composer 安装命令:

composer require chamber-orchestra/doctrine-extensions-bundle

包简介

The symfony doctrine extensions bundle

README 文档

README

A Symfony bundle that provides lightweight Doctrine extensions for common entity patterns and utility types. It includes reusable entity traits, a soft-delete filter, a custom decimal DBAL type, and a SQL random() DQL function.

Requirements

  • PHP ^8.4
  • Symfony FrameworkBundle
  • Doctrine ORM and DoctrineBundle

Installation

Install via Composer:

composer require chamber-orchestra/doctrine-extensions-bundle

Enable the bundle (if not using Symfony Flex auto-discovery):

// config/bundles.php
return [
    ChamberOrchestra\DoctrineExtensionsBundle\ChamberOrchestraDoctrineExtensionsBundle::class => ['all' => true],
];

Usage

Entity traits

Use the bundled traits in your Doctrine entities:

use ChamberOrchestra\DoctrineExtensionsBundle\Entity\IdTrait;
use ChamberOrchestra\DoctrineExtensionsBundle\Entity\ToggleTrait;
use ChamberOrchestra\DoctrineExtensionsBundle\Entity\SoftDeleteTrait;

class Article
{
    use IdTrait;
    use ToggleTrait;
    use SoftDeleteTrait;
}

Soft-delete filter

Register and enable the filter in Doctrine configuration, then disable per entity when needed:

$filter = $entityManager->getFilters()->enable('soft_delete');
$filter->disableForEntity(Article::class);

DQL random function

Register the function in Doctrine config and use it in DQL:

// doctrine.yaml
// doctrine:
//   orm:
//     dql:
//       numeric_functions:
//         random: ChamberOrchestra\DoctrineExtensionsBundle\Function\Random
$qb->select('a')->from(Article::class, 'a')->orderBy('random()');

Decimal DBAL type

Use the custom type for decimal precision and ensure Doctrine knows the type:

#[ORM\Column(type: 'decimal')]
private string $price;

Dependencies

Declared in composer.json:

  • doctrine/orm
  • doctrine/doctrine-bundle
  • symfony/framework-bundle

Running tests

composer test

This executes PHPUnit using phpunit.xml.dist.

统计信息

  • 总下载量: 2
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04