定制 damianociarla/dynamic-discriminator-map-bundle 二次开发

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

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

damianociarla/dynamic-discriminator-map-bundle

最新稳定版本:v1.0.2

Composer 安装命令:

composer require damianociarla/dynamic-discriminator-map-bundle

包简介

DCSDynamicDiscriminatorMapBundle simplifies the use of Doctrine Single Table Inheritance mapping strategy in Symfony2.

README 文档

README

DynamicDiscriminatorMapBundle simplifies the use of Doctrine Single Table and Class Table Inheritance mapping strategy in Symfony2

With this bundle you can adds dynamically all classes of a hierarchy to the options of DiscriminatorMap using a config file. This way you can apply the methodology of 'decoupling'

Installation

Step 1: Download DynamicDiscriminatorMapBundle using composer

Add DynamicDiscriminatorMapBundle in your composer.json:

{ "require": { "damianociarla/dynamic-discriminator-map-bundle": "dev-master" } } 

Step 2: Enable the bundle

Enable the bundle in the kernel:

<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new DCS\DynamicDiscriminatorMapBundle\DCSDynamicDiscriminatorMapBundle(), ); } 

Configuration

Parent class

This is an example of a parent class

<?php namespace Acme\PersonBundle\Entity; /** * @ORM\Entity * @ORM\Table(name="person") * @ORM\InheritanceType("SINGLE_TABLE") * @ORM\DiscriminatorColumn(name="type", type="string") * @ORM\DiscriminatorMap({"person" = "Person"}) */ class Person { // ... } 

Children classes

This is an example of two children classes

<?php namespace Acme\StudentBundle\Entity; use Acme\PersonBundle\Entity\Person; /** * @ORM\Entity */ class Student extends Person { // ... } <?php namespace Acme\TeacherBundle\Entity; use Acme\PersonBundle\Entity\Person; /** * @ORM\Entity */ class Teacher extends Person { // ... } 

Configuration file

# app/config/config.yml dcs_dynamic_discriminator_map: mapping: person: entity: Acme\PersonBundle\Entity\Person map: student: Acme\StudentBundle\Entity\Student teacher: Acme\TeacherBundle\Entity\Teacher 

统计信息

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

GitHub 信息

  • Stars: 12
  • Watchers: 1
  • Forks: 9
  • 开发语言: PHP

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固