Skip to content

Decimal type from ext-decimal PHP extension support for Cycle ORM

License

Notifications You must be signed in to change notification settings

marekskopal/cycle-decimal

Repository files navigation

Cycle ORM - Decimal support

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;
}

About

Decimal type from ext-decimal PHP extension support for Cycle ORM

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages