Doctrine\OXM\Types\DateTimeType::convertToPHPValue PHP Method

convertToPHPValue() public method

public convertToPHPValue ( $value )
    public function convertToPHPValue($value)
    {
        if ($value === null) {
            return null;
        }
        $val = \DateTime::createFromFormat(static::FORMAT, $value);
        if (!$val) {
            throw ConversionException::conversionFailed($value, $this->getName());
        }
        return $val;
    }

Usage Example

コード例 #1
0
ファイル: DateTimeTest.php プロジェクト: GromNaN/oxm
 public function testNullConversion()
 {
     $this->assertNull($this->_type->convertToPHPValue(null));
 }