File tree Expand file tree Collapse file tree 2 files changed +24
-6
lines changed Expand file tree Collapse file tree 2 files changed +24
-6
lines changed Original file line number Diff line number Diff line change 5
5
namespace Doctrine \DBAL \Types \Exception ;
6
6
7
7
use Exception ;
8
+ use Throwable ;
8
9
9
10
use function sprintf ;
10
11
@@ -35,19 +36,22 @@ public static function new(string $name): self
35
36
return $ object ;
36
37
}
37
38
38
- public static function newWithContext (string $ name , string $ tableName ): self
39
+ public static function newWithContext (string $ name , string $ tableName, ? Throwable $ previous ): self
39
40
{
40
- $ object = new self (sprintf (
41
- 'Unknown column type "%s" requested for table "%s". Any Doctrine type that you use has '
41
+ $ object = new self (
42
+ sprintf (
43
+ 'Unknown column type "%s" requested for table "%s". Any Doctrine type that you use has '
42
44
. 'to be registered with \Doctrine\DBAL\Types\Type::addType(). You can get a list of all the '
43
45
. 'known types with \Doctrine\DBAL\Types\Type::getTypesMap(). If this error occurs during database '
44
46
. 'introspection then you might have forgotten to register all database types for a Doctrine Type. '
45
47
. 'Use AbstractPlatform#registerDoctrineTypeMapping() or have your custom types implement '
46
48
. 'Type#getMappedDatabaseTypes(). If the type name is empty you might '
47
49
. 'have a problem with the cache or forgot some mapping information. ' ,
48
- $ name ,
49
- $ tableName ,
50
- ));
50
+ $ name ,
51
+ $ tableName ,
52
+ ),
53
+ previous: $ previous ,
54
+ );
51
55
52
56
$ object ->requestedType = $ name ;
53
57
Original file line number Diff line number Diff line change 7
7
use Doctrine \DBAL \Schema \Column ;
8
8
use Doctrine \DBAL \Schema \Exception \InvalidColumnDefinition ;
9
9
use Doctrine \DBAL \Schema \Name \UnqualifiedName ;
10
+ use Doctrine \DBAL \Types \Exception \UnknownColumnType ;
10
11
use Doctrine \DBAL \Types \IntegerType ;
11
12
use Doctrine \DBAL \Types \Type ;
12
13
use Doctrine \DBAL \Types \Types ;
@@ -78,4 +79,17 @@ public function testTypeNotSet(): void
78
79
79
80
$ editor ->create ();
80
81
}
82
+
83
+ public function testInvalidType (): void
84
+ {
85
+ $ this ->expectException (UnknownColumnType::class);
86
+ $ this ->expectExceptionMessage ('Unknown column type "unknown_type" ' );
87
+
88
+ Column::editor ()
89
+ ->setUnquotedName ('column_char ' )
90
+ ->setTypeName ('unknown_type ' )
91
+ ->setFixed (true )
92
+ ->setLength (2 )
93
+ ->create ();
94
+ }
81
95
}
You can’t perform that action at this time.
0 commit comments