teamq-ec / teamq-doctrine-behaviors
Doctrine Behavior Traits for Symfony: Translatable
Installs: 111
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
pkg:composer/teamq-ec/teamq-doctrine-behaviors
Requires
- php: >=8.0
 - doctrine/common: ^3.3
 - doctrine/dbal: ^3.8.0|^4.1
 - doctrine/doctrine-bundle: ^2.7.2
 - doctrine/orm: ^2.12|^3.0.0
 - doctrine/persistence: ^2.5|^3.0|^4.0
 - nette/utils: ^3.2|^4.0
 - ramsey/uuid: ^4.2
 - symfony/cache: ^5.4|^6.0|^7.0|^7.1|^7.2|^7.3
 - symfony/dependency-injection: ^5.4|^6.0|^7.0|^7.1|^7.2|^7.3
 - symfony/framework-bundle: ^5.4|^6.0|^7.0|^7.1|^7.2|^7.3
 - symfony/http-kernel: ^5.4|^6.0|^7.0|^7.1|^7.2|^7.3
 - symfony/security-bundle: ^5.4|^6.0|^7.0|^7.1|^7.2|^7.3
 - symfony/string: ^5.4|^6.0|^7.0|^7.1|^7.2|^7.3
 - symfony/translation-contracts: ^2.4|^3.0
 
Requires (Dev)
- ext-pdo_mysql: *
 - ext-pdo_pgsql: *
 - ext-pdo_sqlite: *
 - doctrine/annotations: ^2.0.1
 - php-parallel-lint/php-parallel-lint: ^1.3
 - phpstan/extension-installer: ^1.1
 - phpstan/phpstan: ^1.7.10
 - phpstan/phpstan-doctrine: ^1.3
 - phpstan/phpstan-phpunit: ^1.1
 - phpunit/phpunit: ^9.5
 - psr/log: ^1.1
 - rector/rector: ^1.0.0
 - symplify/easy-ci: ^10.2.9
 - symplify/easy-coding-standard: ^10.2.9
 - symplify/package-builder: ^10.2.9
 - symplify/phpstan-extensions: ^10.2.9
 - symplify/phpstan-rules: ^10.2.9
 
This package is auto-updated.
Last update: 2025-10-08 08:27:59 UTC
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