File tree Expand file tree Collapse file tree 3 files changed +24
-2
lines changed
tests/Doctrine/Tests/DBAL Expand file tree Collapse file tree 3 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -838,4 +838,17 @@ private function normalizeIdentifier($identifier)
838
838
839
839
return $ this ->trimQuotes (strtolower ($ identifier ));
840
840
}
841
+
842
+ public function setComment (?string $ comment ) : self
843
+ {
844
+ // For keeping backward compatibility with MySQL in previous releases, table comments are stored as options.
845
+ $ this ->addOption ('comment ' , $ comment );
846
+
847
+ return $ this ;
848
+ }
849
+
850
+ public function getComment () : ?string
851
+ {
852
+ return $ this ->_options ['comment ' ] ?? null ;
853
+ }
841
854
}
Original file line number Diff line number Diff line change @@ -1580,10 +1580,10 @@ public function testCommentInTable() : void
1580
1580
{
1581
1581
$ table = new Table ('table_with_comment ' );
1582
1582
$ table ->addColumn ('id ' , 'integer ' );
1583
- $ table ->addOption ( ' comment ' , 'Foo with control characters \'\\' );
1583
+ $ table ->setComment ( 'Foo with control characters \'\\' );
1584
1584
$ this ->schemaManager ->dropAndCreateTable ($ table );
1585
1585
1586
1586
$ table = $ this ->schemaManager ->listTableDetails ('table_with_comment ' );
1587
- self ::assertSame ('Foo with control characters \'\\' , $ table ->getOption ( ' comment ' ));
1587
+ self ::assertSame ('Foo with control characters \'\\' , $ table ->getComment ( ));
1588
1588
}
1589
1589
}
Original file line number Diff line number Diff line change @@ -882,4 +882,13 @@ public function getNormalizesAssetNames()
882
882
['"FOO" ' ],
883
883
];
884
884
}
885
+
886
+ public function testTableComment ()
887
+ {
888
+ $ table = new Table ('bar ' );
889
+ self ::assertNull ($ table ->getComment ());
890
+
891
+ $ table ->setComment ('foo ' );
892
+ self ::assertEquals ('foo ' , $ table ->getComment ());
893
+ }
885
894
}
You can’t perform that action at this time.
0 commit comments