Sonata\Component\Currency\CurrencyDoctrineType::convertToPHPValue PHP Method

convertToPHPValue() public method

public convertToPHPValue ( $value, Doctrine\DBAL\Platforms\AbstractPlatform $platform )
$platform Doctrine\DBAL\Platforms\AbstractPlatform
    public function convertToPHPValue($value, AbstractPlatform $platform)
    {
        if (!array_key_exists($value, Intl::getCurrencyBundle()->getCurrencyNames())) {
            throw new \RuntimeException(sprintf("'%d' is not a supported currency.", $value));
        }
        $currency = new Currency();
        $currency->setLabel($value);
        return $currency;
    }