teamq-ec/teamq-doctrine-behaviors
最新稳定版本:v2.0.0
Composer 安装命令:
composer require teamq-ec/teamq-doctrine-behaviors
包简介
Doctrine Behavior Traits for Symfony: Translatable
README 文档
README
Developing Dreams
Doctrine Behaviors
This PHP library is a collection of traits and interfaces that add behaviors translataions to Doctrine entities and repositories, project based in package knplabs/doctrine-behaviors
It currently handles:
Install
composer teamq-ec/teamq-doctrine-behaviors
Usage
All you have to do is to define a Doctrine entity:
- implemented interface
- add a trait
Voilà!
You now have a working Category that behaves like.
PHPStan
A PHPStan extension is available and provides the following features:
- Provides correct return type for
TranslatableInterface::getTranslations()andTranslatableInterface::getNewTranslations() - Provides correct return type for
TranslatableInterface::translate() - Provides correct return type for
TranslationInterface::getTranslatable()
Include phpstan-extension.neon in your project's PHPStan config:
# phpstan.neon includes: - vendor/teamq-ec/teamq-doctrine-behaviors/phpstan-extension.neon
3 Steps to Contribute
-
1 feature per pull-request
-
New feature needs tests
-
Tests and static analysis must pass:
vendor/bin/phpunit composer fix-cs composer phpstan
Upgrade 1.x to 2
There have been many changes between 1 and 2, but don't worry. This package uses Rector, that handles upgrade for you.
composer require rector/rector --dev
Create rector.php config:
vendor/bin/rector init
Add Doctrine Behaviors upgrade set to rector.php:
use Rector\Core\Configuration\Option; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use Rector\Doctrine\Set\DoctrineSetList; return static function (ContainerConfigurator $containerConfigurator): void { $containerConfigurator->import(DoctrineSetList::DOCTRINE_BEHAVIORS_20); };
Run Rector:
vendor/bin/rector process src
统计信息
- 总下载量: 111
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-05-30