hopeter1018/sequential-counter-format-bundle
Composer 安装命令:
composer require hopeter1018/sequential-counter-format-bundle
包简介
This bundle aims to generate value for doctrine entities.
关键字:
README 文档
README
Introduction
This bundle aims to generate value for doctrine entities.
Installation
Require the package
composer require hopeter1018/sequential-counter-format-bundle
Add to kernel
Symfony 4+ or Symfony Flex
Add /config/bundles.php
return [ ..., HoPeter1018\SequentialCounterFormatBundle\HoPeter1018SequentialCounterFormatBundle::class => ['all' => true], ];
Symfony 2+
Add /app/AppKernel.php
$bundles = [ ..., new HoPeter1018\SequentialCounterFormatBundle\HoPeter1018SequentialCounterFormatBundle(), ];
Config
thru config.yml / config.yaml
ho_peter1018_sequential_counter_format: # managers: ['default'] # add / modify if you are not using 'default' rules: _rule_alias_: entity_class: 'Your\Bundle\Entity\EntityClass' property: 'yamlTargetPropertyName' format: '__SEE_FORMAT_SECTION__'
thru Doctrine Annotation
namespace Your\Bundle\Entity; use HoPeter1018\SequentialCounterFormatBundle\Annotations as Scf; /** * Class docblock * * @Scf\ClassRule(settings={ * "classAnnotationTargetPropertyName"={"format"="__SEE_FORMAT_SECTION__", "batchPrefix"="[site.id]"}, * }) */ class EntityClass { /** * @Scf\PropertyRule("__SEE_FORMAT_SECTION__") * @ORM\Column(type="string", length=255) */ private $propertyAnnotationTargetPropertyName; /** * @ORM\Column(type="string", length=255) */ private $classAnnotationTargetPropertyName; /** * declared in the above section: `thru config.yml / config.yaml` */ private $yamlTargetPropertyName; }
Usage
Format Placeholder
| Type | Format | Description |
|---|---|---|
| Sequence | %d | same as sprintf Only %d is supported right now. |
| Date | {format_character} | same as date EACH Date format should wrap separately. Currently supports: YyMmWdwNHiif you want 19970101, you should do {Y}{m}{d} |
| Property | [property_name] | Powered by Symfony's PropertyAccess Component |
统计信息
- 总下载量: 99
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-07-08