* @author Gediminas Morkevicius * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ class Validator { /** * List of types which are valid for timestamp * * @var array */ public static $validTypes = array( 'date', 'date_immutable', 'time', 'time_immutable', 'datetime', 'datetime_immutable', 'datetimetz', 'datetimetz_immutable', 'timestamp', 'zenddate', ); public static function validateField(ClassMetadata $meta, $field) { if ($meta->isMappedSuperclass) { return; } $fieldMapping = $meta->getFieldMapping($field); if (!in_array($fieldMapping['type'], self::$validTypes)) { throw new InvalidMappingException(sprintf('Field "%s" (type "%s") must be of one of the following types: "%s" in entity %s', $field, $fieldMapping['type'], implode(', ', self::$validTypes), $meta->name)); } } }