roukmoute / doctrine-prefix-bundle
为表和序列添加前缀的监听器
v1.0.2
2020-01-15 11:02 UTC
Requires
- doctrine/event-manager: ^1.1
- doctrine/orm: ^2.7
- symfony/config: 3.4.*|4.4.*
- symfony/dependency-injection: 3.4.*|4.4.*
- symfony/http-kernel: 3.4.*|4.4.*
This package is auto-updated.
Last update: 2024-08-27 12:49:54 UTC
README
DoctrinePrefixBundle
此包可以为表和序列添加您选择的字符串前缀,通过更改实体的元数据。如果您需要与来自其他项目的表共享数据库,或者想要使用像 user
或 group
这样的保留关键字来命名实体,则前缀非常有用。
安装
composer require roukmoute/doctrine-prefix-bundle
配置
首先,您需要将包注册到应用程序内核中,如下所示
<?php //app/AppKernel.php use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Config\Loader\LoaderInterface; class AppKernel extends Kernel { public function registerBundles() { $bundles = array( new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), new Symfony\Bundle\SecurityBundle\SecurityBundle(), … new Roukmoute\DoctrinePrefixBundle\RoukmouteDoctrinePrefixBundle() ); …
配置如下所示
roukmoute_doctrine_prefix: # will be prepended to table and sequence names prefix: sf # if set, the prefix will be applied to specified bundles only bundles: [] # the encoding to convert the prefix to encoding: UTF-8