| @@ 30-84 (lines=55) @@ | ||
| 27 | /** |
|
| 28 | * Custom Type for the ContactInformation Value Object for the Configuration domain |
|
| 29 | */ |
|
| 30 | class ConfigurationContactInformationType extends Type |
|
| 31 | { |
|
| 32 | const NAME = 'stepup_configuration_contact_information'; |
|
| 33 | ||
| 34 | public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) |
|
| 35 | { |
|
| 36 | return $platform->getClobTypeDeclarationSQL($fieldDeclaration); |
|
| 37 | } |
|
| 38 | ||
| 39 | public function convertToDatabaseValue($value, AbstractPlatform $platform) |
|
| 40 | { |
|
| 41 | if (is_null($value)) { |
|
| 42 | return null; |
|
| 43 | } |
|
| 44 | ||
| 45 | if (!$value instanceof ContactInformation) { |
|
| 46 | throw new ConversionException( |
|
| 47 | sprintf( |
|
| 48 | "Encountered illegal contact information of type %s '%s', expected a ContactInformation instance", |
|
| 49 | is_object($value) ? get_class($value) : gettype($value), |
|
| 50 | is_scalar($value) ? (string) $value : '' |
|
| 51 | ) |
|
| 52 | ); |
|
| 53 | } |
|
| 54 | ||
| 55 | return $value->getContactInformation(); |
|
| 56 | } |
|
| 57 | ||
| 58 | public function convertToPHPValue($value, AbstractPlatform $platform) |
|
| 59 | { |
|
| 60 | if (is_null($value)) { |
|
| 61 | return $value; |
|
| 62 | } |
|
| 63 | ||
| 64 | try { |
|
| 65 | $contactInformation = new ContactInformation($value); |
|
| 66 | } catch (InvalidArgumentException $e) { |
|
| 67 | // get nice standard message, so we can throw it keeping the exception chain |
|
| 68 | $doctrineExceptionMessage = ConversionException::conversionFailedFormat( |
|
| 69 | $value, |
|
| 70 | $this->getName(), |
|
| 71 | $platform->getDateTimeFormatString() |
|
| 72 | )->getMessage(); |
|
| 73 | ||
| 74 | throw new ConversionException($doctrineExceptionMessage, 0, $e); |
|
| 75 | } |
|
| 76 | ||
| 77 | return $contactInformation; |
|
| 78 | } |
|
| 79 | ||
| 80 | public function getName() |
|
| 81 | { |
|
| 82 | return self::NAME; |
|
| 83 | } |
|
| 84 | } |
|
| 85 | ||
| @@ 30-84 (lines=55) @@ | ||
| 27 | /** |
|
| 28 | * Custom Type for the Institution Value Object for the Configuration domain |
|
| 29 | */ |
|
| 30 | class ConfigurationInstitutionType extends Type |
|
| 31 | { |
|
| 32 | const NAME = 'stepup_configuration_institution'; |
|
| 33 | ||
| 34 | public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) |
|
| 35 | { |
|
| 36 | return $platform->getVarcharTypeDeclarationSQL($fieldDeclaration); |
|
| 37 | } |
|
| 38 | ||
| 39 | public function convertToDatabaseValue($value, AbstractPlatform $platform) |
|
| 40 | { |
|
| 41 | if (is_null($value)) { |
|
| 42 | return $value; |
|
| 43 | } |
|
| 44 | ||
| 45 | if (!$value instanceof Institution) { |
|
| 46 | throw new ConversionException( |
|
| 47 | sprintf( |
|
| 48 | "Encountered illegal institution of type %s '%s', expected an Institution instance", |
|
| 49 | is_object($value) ? get_class($value) : gettype($value), |
|
| 50 | is_scalar($value) ? (string) $value : '' |
|
| 51 | ) |
|
| 52 | ); |
|
| 53 | } |
|
| 54 | ||
| 55 | return $value->getInstitution(); |
|
| 56 | } |
|
| 57 | ||
| 58 | public function convertToPHPValue($value, AbstractPlatform $platform) |
|
| 59 | { |
|
| 60 | if (is_null($value)) { |
|
| 61 | return $value; |
|
| 62 | } |
|
| 63 | ||
| 64 | try { |
|
| 65 | $institution = new Institution($value); |
|
| 66 | } catch (InvalidArgumentException $e) { |
|
| 67 | // get nice standard message, so we can throw it keeping the exception chain |
|
| 68 | $doctrineExceptionMessage = ConversionException::conversionFailedFormat( |
|
| 69 | $value, |
|
| 70 | $this->getName(), |
|
| 71 | $platform->getDateTimeFormatString() |
|
| 72 | )->getMessage(); |
|
| 73 | ||
| 74 | throw new ConversionException($doctrineExceptionMessage, 0, $e); |
|
| 75 | } |
|
| 76 | ||
| 77 | return $institution; |
|
| 78 | } |
|
| 79 | ||
| 80 | public function getName() |
|
| 81 | { |
|
| 82 | return self::NAME; |
|
| 83 | } |
|
| 84 | } |
|
| 85 | ||
| @@ 30-84 (lines=55) @@ | ||
| 27 | /** |
|
| 28 | * Custom Type for the Location Value Object for the Configuration domain |
|
| 29 | */ |
|
| 30 | class ConfigurationLocationType extends Type |
|
| 31 | { |
|
| 32 | const NAME = 'stepup_configuration_location'; |
|
| 33 | ||
| 34 | public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) |
|
| 35 | { |
|
| 36 | return $platform->getClobTypeDeclarationSQL($fieldDeclaration); |
|
| 37 | } |
|
| 38 | ||
| 39 | public function convertToDatabaseValue($value, AbstractPlatform $platform) |
|
| 40 | { |
|
| 41 | if (is_null($value)) { |
|
| 42 | return $value; |
|
| 43 | } |
|
| 44 | ||
| 45 | if (!$value instanceof Location) { |
|
| 46 | throw new ConversionException( |
|
| 47 | sprintf( |
|
| 48 | "Encountered illegal location of type %s '%s', expected a Location instance", |
|
| 49 | is_object($value) ? get_class($value) : gettype($value), |
|
| 50 | is_scalar($value) ? (string) $value : '' |
|
| 51 | ) |
|
| 52 | ); |
|
| 53 | } |
|
| 54 | ||
| 55 | return $value->getLocation(); |
|
| 56 | } |
|
| 57 | ||
| 58 | public function convertToPHPValue($value, AbstractPlatform $platform) |
|
| 59 | { |
|
| 60 | if (is_null($value)) { |
|
| 61 | return $value; |
|
| 62 | } |
|
| 63 | ||
| 64 | try { |
|
| 65 | $location = new Location($value); |
|
| 66 | } catch (InvalidArgumentException $e) { |
|
| 67 | // get nice standard message, so we can throw it keeping the exception chain |
|
| 68 | $doctrineExceptionMessage = ConversionException::conversionFailedFormat( |
|
| 69 | $value, |
|
| 70 | $this->getName(), |
|
| 71 | $platform->getDateTimeFormatString() |
|
| 72 | )->getMessage(); |
|
| 73 | ||
| 74 | throw new ConversionException($doctrineExceptionMessage, 0, $e); |
|
| 75 | } |
|
| 76 | ||
| 77 | return $location; |
|
| 78 | } |
|
| 79 | ||
| 80 | public function getName() |
|
| 81 | { |
|
| 82 | return self::NAME; |
|
| 83 | } |
|
| 84 | } |
|
| 85 | ||
| @@ 30-84 (lines=55) @@ | ||
| 27 | /** |
|
| 28 | * Custom Type for the RaLocationName Value Object |
|
| 29 | */ |
|
| 30 | class RaLocationNameType extends Type |
|
| 31 | { |
|
| 32 | const NAME = 'stepup_ra_location_name'; |
|
| 33 | ||
| 34 | public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) |
|
| 35 | { |
|
| 36 | return $platform->getVarcharTypeDeclarationSQL([]); |
|
| 37 | } |
|
| 38 | ||
| 39 | public function convertToDatabaseValue($value, AbstractPlatform $platform) |
|
| 40 | { |
|
| 41 | if (is_null($value)) { |
|
| 42 | return $value; |
|
| 43 | } |
|
| 44 | ||
| 45 | if (!$value instanceof RaLocationName) { |
|
| 46 | throw new ConversionException( |
|
| 47 | sprintf( |
|
| 48 | "Encountered illegal RA location name of type %s '%s', expected a RaLocationName instance", |
|
| 49 | is_object($value) ? get_class($value) : gettype($value), |
|
| 50 | is_scalar($value) ? (string) $value : '' |
|
| 51 | ) |
|
| 52 | ); |
|
| 53 | } |
|
| 54 | ||
| 55 | return $value->getRaLocationName(); |
|
| 56 | } |
|
| 57 | ||
| 58 | public function convertToPHPValue($value, AbstractPlatform $platform) |
|
| 59 | { |
|
| 60 | if (is_null($value)) { |
|
| 61 | return $value; |
|
| 62 | } |
|
| 63 | ||
| 64 | try { |
|
| 65 | $raLocationName = new RaLocationName($value); |
|
| 66 | } catch (InvalidArgumentException $e) { |
|
| 67 | // get nice standard message, so we can throw it keeping the exception chain |
|
| 68 | $doctrineExceptionMessage = ConversionException::conversionFailedFormat( |
|
| 69 | $value, |
|
| 70 | $this->getName(), |
|
| 71 | $platform->getDateTimeFormatString() |
|
| 72 | )->getMessage(); |
|
| 73 | ||
| 74 | throw new ConversionException($doctrineExceptionMessage, 0, $e); |
|
| 75 | } |
|
| 76 | ||
| 77 | return $raLocationName; |
|
| 78 | } |
|
| 79 | ||
| 80 | public function getName() |
|
| 81 | { |
|
| 82 | return self::NAME; |
|
| 83 | } |
|
| 84 | } |
|
| 85 | ||
| @@ 30-84 (lines=55) @@ | ||
| 27 | /** |
|
| 28 | * Custom Type for the UseRaLocationsOption Value Object |
|
| 29 | */ |
|
| 30 | class UseRaLocationsOptionType extends Type |
|
| 31 | { |
|
| 32 | const NAME = 'stepup_use_ra_locations_option'; |
|
| 33 | ||
| 34 | public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) |
|
| 35 | { |
|
| 36 | return $platform->getBooleanTypeDeclarationSQL($fieldDeclaration); |
|
| 37 | } |
|
| 38 | ||
| 39 | public function convertToDatabaseValue($value, AbstractPlatform $platform) |
|
| 40 | { |
|
| 41 | if (is_null($value)) { |
|
| 42 | return $value; |
|
| 43 | } |
|
| 44 | ||
| 45 | if (!$value instanceof UseRaLocationsOption) { |
|
| 46 | throw new ConversionException( |
|
| 47 | sprintf( |
|
| 48 | "Encountered illegal location of type %s '%s', expected a UseRaLocationsOption instance", |
|
| 49 | is_object($value) ? get_class($value) : gettype($value), |
|
| 50 | is_scalar($value) ? (string) $value : '' |
|
| 51 | ) |
|
| 52 | ); |
|
| 53 | } |
|
| 54 | ||
| 55 | return $value->isEnabled(); |
|
| 56 | } |
|
| 57 | ||
| 58 | public function convertToPHPValue($value, AbstractPlatform $platform) |
|
| 59 | { |
|
| 60 | if (is_null($value)) { |
|
| 61 | return $value; |
|
| 62 | } |
|
| 63 | ||
| 64 | try { |
|
| 65 | $useRaLocationsOption = new UseRaLocationsOption($value); |
|
| 66 | } catch (InvalidArgumentException $e) { |
|
| 67 | // get nice standard message, so we can throw it keeping the exception chain |
|
| 68 | $doctrineExceptionMessage = ConversionException::conversionFailedFormat( |
|
| 69 | $value, |
|
| 70 | $this->getName(), |
|
| 71 | $platform->getDateTimeFormatString() |
|
| 72 | )->getMessage(); |
|
| 73 | ||
| 74 | throw new ConversionException($doctrineExceptionMessage, 0, $e); |
|
| 75 | } |
|
| 76 | ||
| 77 | return $useRaLocationsOption; |
|
| 78 | } |
|
| 79 | ||
| 80 | public function getName() |
|
| 81 | { |
|
| 82 | return self::NAME; |
|
| 83 | } |
|
| 84 | } |
|
| 85 | ||
| @@ 30-84 (lines=55) @@ | ||
| 27 | /** |
|
| 28 | * Custom Type for the ShowRaaContactInformationOption Value Object |
|
| 29 | */ |
|
| 30 | class ShowRaaContactInformationOptionType extends Type |
|
| 31 | { |
|
| 32 | const NAME = 'stepup_show_raa_contact_information_option'; |
|
| 33 | ||
| 34 | public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) |
|
| 35 | { |
|
| 36 | return $platform->getBooleanTypeDeclarationSQL($fieldDeclaration); |
|
| 37 | } |
|
| 38 | ||
| 39 | public function convertToDatabaseValue($value, AbstractPlatform $platform) |
|
| 40 | { |
|
| 41 | if (is_null($value)) { |
|
| 42 | return $value; |
|
| 43 | } |
|
| 44 | ||
| 45 | if (!$value instanceof ShowRaaContactInformationOption) { |
|
| 46 | throw new ConversionException( |
|
| 47 | sprintf( |
|
| 48 | "Encountered illegal location of type %s '%s', expected a ShowRaaContactInformationOption instance", |
|
| 49 | is_object($value) ? get_class($value) : gettype($value), |
|
| 50 | is_scalar($value) ? (string) $value : '' |
|
| 51 | ) |
|
| 52 | ); |
|
| 53 | } |
|
| 54 | ||
| 55 | return $value->isEnabled(); |
|
| 56 | } |
|
| 57 | ||
| 58 | public function convertToPHPValue($value, AbstractPlatform $platform) |
|
| 59 | { |
|
| 60 | if (is_null($value)) { |
|
| 61 | return $value; |
|
| 62 | } |
|
| 63 | ||
| 64 | try { |
|
| 65 | $showRaaContactInformationOption = new ShowRaaContactInformationOption($value); |
|
| 66 | } catch (InvalidArgumentException $e) { |
|
| 67 | // get nice standard message, so we can throw it keeping the exception chain |
|
| 68 | $doctrineExceptionMessage = ConversionException::conversionFailedFormat( |
|
| 69 | $value, |
|
| 70 | $this->getName(), |
|
| 71 | $platform->getDateTimeFormatString() |
|
| 72 | )->getMessage(); |
|
| 73 | ||
| 74 | throw new ConversionException($doctrineExceptionMessage, 0, $e); |
|
| 75 | } |
|
| 76 | ||
| 77 | return $showRaaContactInformationOption; |
|
| 78 | } |
|
| 79 | ||
| 80 | public function getName() |
|
| 81 | { |
|
| 82 | return self::NAME; |
|
| 83 | } |
|
| 84 | } |
|
| 85 | ||