marekskopal / cycle-decimal
Decimal type from ext-decimal PHP extension support for Cycle ORM
v0.3.0
2024-03-20 21:05 UTC
Requires
- php: >=8.1
- ext-decimal: ^1.1
- cycle/annotated: ^4.1
- cycle/orm: ^2.7
Requires (Dev)
- phpstan/extension-installer: ^1.3
- phpstan/phpstan: ^1.10
- phpstan/phpstan-strict-rules: ^1.5
- phpunit/phpunit: ^10.2
- slevomat/coding-standard: ^8.14
- spatie/ray: ^1.39
README
Decimal type from ext-decimal PHP extension support for Cycle ORM.
Install
composer require marekskopal/cycle-decimal
Usage
Add DecimalTypecast
to your entity typecast list and use Decimal type in your entity.
use Cycle\Annotated\Annotation\Column; use Cycle\Annotated\Annotation\Entity; use Cycle\ORM\Parser\Typecast; use Decimal\Decimal; use MarekSkopal\Cycle\Decimal\ColumnDecimal; use MarekSkopal\Cycle\Decimal\DecimalTypecast; #[Entity( typecast: [ Typecast::class, DecimalTypecast::class, ] )] class MyEntity { #[Column(type: 'decimal(8,2)', typecast: DecimalTypecast::Type)] public Decimal $value; #[Column(type: 'decimal(8,2)', typecast: 'decimal(8,2)')] public Decimal $valueWithPrecision; #[ColumnDecimal(precision: 8, scale: 2)] public Decimal $valueWithAttribute; }