Dumplie\CustomerService\Infrastructure\Doctrine\ORM\Type\Domain\PaymentStateType::convertToPhpValue PHP Method

convertToPhpValue() public method

public convertToPhpValue ( mixed $value, Doctrine\DBAL\Platforms\AbstractPlatform $platform ) : Dumplie\CustomerService\Domain\PaymentState
$value mixed
$platform Doctrine\DBAL\Platforms\AbstractPlatform
return Dumplie\CustomerService\Domain\PaymentState
    public function convertToPhpValue($value, AbstractPlatform $platform)
    {
        if (is_null($value)) {
            return [];
        }
        switch ($value) {
            case 1:
                return new PaymentState\Unpaid();
            case 2:
                return new PaymentState\Paid();
            case 3:
                return new PaymentState\Rejected();
            default:
                ConversionException::conversionFailed($value, $this->getName());
        }
    }