| @@ 30-83 (lines=54) @@ | ||
| 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::conversionFailed( | |
| 69 | $value, | |
| 70 | $this->getName() | |
| 71 | )->getMessage(); | |
| 72 | ||
| 73 | throw new ConversionException($doctrineExceptionMessage, 0, $e); | |
| 74 | } | |
| 75 | ||
| 76 | return $contactInformation; | |
| 77 | } | |
| 78 | ||
| 79 | public function getName() | |
| 80 |     { | |
| 81 | return self::NAME; | |
| 82 | } | |
| 83 | } | |
| 84 | ||
| @@ 30-83 (lines=54) @@ | ||
| 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::conversionFailed( | |
| 69 | $value, | |
| 70 | $this->getName() | |
| 71 | )->getMessage(); | |
| 72 | ||
| 73 | throw new ConversionException($doctrineExceptionMessage, 0, $e); | |
| 74 | } | |
| 75 | ||
| 76 | return $institution; | |
| 77 | } | |
| 78 | ||
| 79 | public function getName() | |
| 80 |     { | |
| 81 | return self::NAME; | |
| 82 | } | |
| 83 | } | |
| 84 | ||
| @@ 30-83 (lines=54) @@ | ||
| 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::conversionFailed( | |
| 69 | $value, | |
| 70 | $this->getName() | |
| 71 | )->getMessage(); | |
| 72 | ||
| 73 | throw new ConversionException($doctrineExceptionMessage, 0, $e); | |
| 74 | } | |
| 75 | ||
| 76 | return $location; | |
| 77 | } | |
| 78 | ||
| 79 | public function getName() | |
| 80 |     { | |
| 81 | return self::NAME; | |
| 82 | } | |
| 83 | } | |
| 84 | ||
| @@ 30-83 (lines=54) @@ | ||
| 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::conversionFailed( | |
| 69 | $value, | |
| 70 | $this->getName() | |
| 71 | )->getMessage(); | |
| 72 | ||
| 73 | throw new ConversionException($doctrineExceptionMessage, 0, $e); | |
| 74 | } | |
| 75 | ||
| 76 | return $raLocationName; | |
| 77 | } | |
| 78 | ||
| 79 | public function getName() | |
| 80 |     { | |
| 81 | return self::NAME; | |
| 82 | } | |
| 83 | } | |
| 84 | ||
| @@ 30-85 (lines=56) @@ | ||
| 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( | |
| 66 | $platform->convertFromBoolean($value) | |
| 67 | ); | |
| 68 |         } catch (InvalidArgumentException $e) { | |
| 69 | // get nice standard message, so we can throw it keeping the exception chain | |
| 70 | $doctrineExceptionMessage = ConversionException::conversionFailed( | |
| 71 | $value, | |
| 72 | $this->getName() | |
| 73 | )->getMessage(); | |
| 74 | ||
| 75 | throw new ConversionException($doctrineExceptionMessage, 0, $e); | |
| 76 | } | |
| 77 | ||
| 78 | return $showRaaContactInformationOption; | |
| 79 | } | |
| 80 | ||
| 81 | public function getName() | |
| 82 |     { | |
| 83 | return self::NAME; | |
| 84 | } | |
| 85 | } | |
| 86 | ||
| @@ 30-83 (lines=54) @@ | ||
| 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($platform->convertFromBoolean($value)); | |
| 66 |         } catch (InvalidArgumentException $e) { | |
| 67 | // get nice standard message, so we can throw it keeping the exception chain | |
| 68 | $doctrineExceptionMessage = ConversionException::conversionFailed( | |
| 69 | $value, | |
| 70 | $this->getName() | |
| 71 | )->getMessage(); | |
| 72 | ||
| 73 | throw new ConversionException($doctrineExceptionMessage, 0, $e); | |
| 74 | } | |
| 75 | ||
| 76 | return $useRaLocationsOption; | |
| 77 | } | |
| 78 | ||
| 79 | public function getName() | |
| 80 |     { | |
| 81 | return self::NAME; | |
| 82 | } | |
| 83 | } | |
| 84 | ||
| @@ 30-83 (lines=54) @@ | ||
| 27 | /** | |
| 28 | * Custom Type for the VerifyEmailOption Value Object | |
| 29 | */ | |
| 30 | class VerifyEmailOptionType extends Type | |
| 31 | { | |
| 32 | const NAME = 'stepup_verify_email_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 VerifyEmailOption) { | |
| 46 | throw new ConversionException( | |
| 47 | sprintf( | |
| 48 | "Encountered illegal location of type %s '%s', expected a VerifyEmailOption 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 | $verifyEmailOption = new VerifyEmailOption($platform->convertFromBoolean($value)); | |
| 66 |         } catch (InvalidArgumentException $e) { | |
| 67 | // get nice standard message, so we can throw it keeping the exception chain | |
| 68 | $doctrineExceptionMessage = ConversionException::conversionFailed( | |
| 69 | $value, | |
| 70 | $this->getName() | |
| 71 | )->getMessage(); | |
| 72 | ||
| 73 | throw new ConversionException($doctrineExceptionMessage, 0, $e); | |
| 74 | } | |
| 75 | ||
| 76 | return $verifyEmailOption; | |
| 77 | } | |
| 78 | ||
| 79 | public function getName() | |
| 80 |     { | |
| 81 | return self::NAME; | |
| 82 | } | |
| 83 | } | |
| 84 | ||