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 55namespace Doctrine \DBAL \Types \Exception ;
66
77use Exception ;
8+ use Throwable ;
89
910use function sprintf ;
1011
@@ -35,19 +36,22 @@ public static function new(string $name): self
3536 return $ object ;
3637 }
3738
38- public static function newWithContext (string $ name , string $ tableName ): self
39+ public static function newWithContext (string $ name , string $ tableName, ? Throwable $ previous ): self
3940 {
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 '
4244 . 'to be registered with \Doctrine\DBAL\Types\Type::addType(). You can get a list of all the '
4345 . 'known types with \Doctrine\DBAL\Types\Type::getTypesMap(). If this error occurs during database '
4446 . 'introspection then you might have forgotten to register all database types for a Doctrine Type. '
4547 . 'Use AbstractPlatform#registerDoctrineTypeMapping() or have your custom types implement '
4648 . 'Type#getMappedDatabaseTypes(). If the type name is empty you might '
4749 . '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+ );
5155
5256 $ object ->requestedType = $ name ;
5357
Original file line number Diff line number Diff line change 77use Doctrine \DBAL \Schema \Column ;
88use Doctrine \DBAL \Schema \Exception \InvalidColumnDefinition ;
99use Doctrine \DBAL \Schema \Name \UnqualifiedName ;
10+ use Doctrine \DBAL \Types \Exception \UnknownColumnType ;
1011use Doctrine \DBAL \Types \IntegerType ;
1112use Doctrine \DBAL \Types \Type ;
1213use Doctrine \DBAL \Types \Types ;
@@ -78,4 +79,17 @@ public function testTypeNotSet(): void
7879
7980 $ editor ->create ();
8081 }
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+ }
8195}
You can’t perform that action at this time.
0 commit comments