66use Doctrine \DBAL \Schema \Column ;
77use Doctrine \DBAL \Schema \Table ;
88use Doctrine \DBAL \Types \Type ;
9+ use Doctrine \DBAL \Types \Types ;
910
1011class FluidColumn
1112{
@@ -48,56 +49,56 @@ public function __construct(FluidSchema $fluidSchema, FluidTable $fluidTable, Ta
4849
4950 public function integer (): FluidColumnOptions
5051 {
51- $ this ->column ->setType (Type::getType (Type ::INTEGER ));
52+ $ this ->column ->setType (Type::getType (Types ::INTEGER ));
5253 return $ this ->getOptions ();
5354 }
5455
5556 public function smallInt (): FluidColumnOptions
5657 {
57- $ this ->column ->setType (Type::getType (Type ::SMALLINT ));
58+ $ this ->column ->setType (Type::getType (Types ::SMALLINT ));
5859 return $ this ->getOptions ();
5960 }
6061
6162 public function bigInt (): FluidColumnOptions
6263 {
63- $ this ->column ->setType (Type::getType (Type ::BIGINT ));
64+ $ this ->column ->setType (Type::getType (Types ::BIGINT ));
6465 return $ this ->getOptions ();
6566 }
6667
6768 public function decimal (int $ precision = 10 , int $ scale = 0 ): FluidColumnOptions
6869 {
69- $ this ->column ->setType (Type::getType (Type ::DECIMAL ));
70+ $ this ->column ->setType (Type::getType (Types ::DECIMAL ));
7071 $ this ->column ->setPrecision ($ precision );
7172 $ this ->column ->setScale ($ scale );
7273 return $ this ->getOptions ();
7374 }
7475
7576 public function float (int $ precision = 10 , int $ scale = 0 ): FluidColumnOptions
7677 {
77- $ this ->column ->setType (Type::getType (Type ::FLOAT ));
78+ $ this ->column ->setType (Type::getType (Types ::FLOAT ));
7879 $ this ->column ->setPrecision ($ precision );
7980 $ this ->column ->setScale ($ scale );
8081 return $ this ->getOptions ();
8182 }
8283
8384 public function string (?int $ length = null , bool $ fixed = false ): FluidColumnOptions
8485 {
85- $ this ->column ->setType (Type::getType (Type ::STRING ));
86+ $ this ->column ->setType (Type::getType (Types ::STRING ));
8687 $ this ->column ->setLength ($ length );
8788 $ this ->column ->setFixed ($ fixed );
8889 return $ this ->getOptions ();
8990 }
9091
9192 public function text (?int $ length = null ): FluidColumnOptions
9293 {
93- $ this ->column ->setType (Type::getType (Type ::TEXT ));
94+ $ this ->column ->setType (Type::getType (Types ::TEXT ));
9495 $ this ->column ->setLength ($ length );
9596 return $ this ->getOptions ();
9697 }
9798
9899 public function guid (): FluidColumnOptions
99100 {
100- $ this ->column ->setType (Type::getType (Type ::GUID ));
101+ $ this ->column ->setType (Type::getType (Types ::GUID ));
101102 return $ this ->getOptions ();
102103 }
103104
@@ -106,93 +107,96 @@ public function guid(): FluidColumnOptions
106107 */
107108 public function binary (?int $ length = null , bool $ fixed = false ): FluidColumnOptions
108109 {
109- $ this ->column ->setType (Type::getType (Type ::BINARY ));
110+ $ this ->column ->setType (Type::getType (Types ::BINARY ));
110111 $ this ->column ->setLength ($ length );
111112 $ this ->column ->setFixed ($ fixed );
112113 return $ this ->getOptions ();
113114 }
114115
115116 public function blob (): FluidColumnOptions
116117 {
117- $ this ->column ->setType (Type::getType (Type ::BLOB ));
118+ $ this ->column ->setType (Type::getType (Types ::BLOB ));
118119 return $ this ->getOptions ();
119120 }
120121
121122 public function boolean (): FluidColumnOptions
122123 {
123- $ this ->column ->setType (Type::getType (Type ::BOOLEAN ));
124+ $ this ->column ->setType (Type::getType (Types ::BOOLEAN ));
124125 return $ this ->getOptions ();
125126 }
126127
127128 public function date (): FluidColumnOptions
128129 {
129- $ this ->column ->setType (Type::getType (Type:: DATE ));
130+ $ this ->column ->setType (Type::getType (Types:: DATE_MUTABLE ));
130131 return $ this ->getOptions ();
131132 }
132133
133134 public function dateImmutable (): FluidColumnOptions
134135 {
135- $ this ->column ->setType (Type::getType (Type ::DATE_IMMUTABLE ));
136+ $ this ->column ->setType (Type::getType (Types ::DATE_IMMUTABLE ));
136137 return $ this ->getOptions ();
137138 }
138139
139140 public function datetime (): FluidColumnOptions
140141 {
141- $ this ->column ->setType (Type::getType (Type:: DATETIME ));
142+ $ this ->column ->setType (Type::getType (Types:: DATETIME_MUTABLE ));
142143 return $ this ->getOptions ();
143144 }
144145
145146 public function datetimeImmutable (): FluidColumnOptions
146147 {
147- $ this ->column ->setType (Type::getType (Type ::DATETIME_IMMUTABLE ));
148+ $ this ->column ->setType (Type::getType (Types ::DATETIME_IMMUTABLE ));
148149 return $ this ->getOptions ();
149150 }
150151
151152 public function datetimeTz (): FluidColumnOptions
152153 {
153- $ this ->column ->setType (Type::getType (Type:: DATETIMETZ ));
154+ $ this ->column ->setType (Type::getType (Types:: DATETIMETZ_MUTABLE ));
154155 return $ this ->getOptions ();
155156 }
156157
157158 public function datetimeTzImmutable (): FluidColumnOptions
158159 {
159- $ this ->column ->setType (Type::getType (Type ::DATETIMETZ_IMMUTABLE ));
160+ $ this ->column ->setType (Type::getType (Types ::DATETIMETZ_IMMUTABLE ));
160161 return $ this ->getOptions ();
161162 }
162163
163164 public function time (): FluidColumnOptions
164165 {
165- $ this ->column ->setType (Type::getType (Type:: TIME ));
166+ $ this ->column ->setType (Type::getType (Types:: TIME_MUTABLE ));
166167 return $ this ->getOptions ();
167168 }
168169
169170 public function timeImmutable (): FluidColumnOptions
170171 {
171- $ this ->column ->setType (Type::getType (Type ::TIME_IMMUTABLE ));
172+ $ this ->column ->setType (Type::getType (Types ::TIME_IMMUTABLE ));
172173 return $ this ->getOptions ();
173174 }
174175
175176 public function dateInterval (): FluidColumnOptions
176177 {
177- $ this ->column ->setType (Type::getType (Type ::DATEINTERVAL ));
178+ $ this ->column ->setType (Type::getType (Types ::DATEINTERVAL ));
178179 return $ this ->getOptions ();
179180 }
180181
182+ /**
183+ * @depracated Use json() instead
184+ */
181185 public function array (): FluidColumnOptions
182186 {
183- $ this ->column ->setType (Type::getType (Type:: TARRAY ));
187+ $ this ->column ->setType (Type::getType (Types:: ARRAY ));
184188 return $ this ->getOptions ();
185189 }
186190
187191 public function simpleArray (): FluidColumnOptions
188192 {
189- $ this ->column ->setType (Type::getType (Type ::SIMPLE_ARRAY ));
193+ $ this ->column ->setType (Type::getType (Types ::SIMPLE_ARRAY ));
190194 return $ this ->getOptions ();
191195 }
192196
193197 public function json (): FluidColumnOptions
194198 {
195- $ this ->column ->setType (Type::getType (Type ::JSON ));
199+ $ this ->column ->setType (Type::getType (Types ::JSON ));
196200 return $ this ->getOptions ();
197201 }
198202
@@ -202,13 +206,16 @@ public function json(): FluidColumnOptions
202206 */
203207 public function jsonArray (): FluidColumnOptions
204208 {
205- $ this ->column ->setType (Type::getType (Type:: JSON_ARRAY ));
209+ $ this ->column ->setType (Type::getType (Types:: JSON ));
206210 return $ this ->getOptions ();
207211 }
208212
213+ /**
214+ * @depracated Use json() instead
215+ */
209216 public function object (): FluidColumnOptions
210217 {
211- $ this ->column ->setType (Type::getType (Type ::OBJECT ));
218+ $ this ->column ->setType (Type::getType (Types ::OBJECT ));
212219 return $ this ->getOptions ();
213220 }
214221
@@ -218,7 +225,7 @@ public function references(string $tableName, ?string $constraintName = null, st
218225
219226 $ table = $ this ->fluidSchema ->getDbalSchema ()->getTable ($ tableName );
220227
221- $ referencedColumns = $ table ->getPrimaryKeyColumns ();
228+ $ referencedColumns = $ table ->getPrimaryKey ()-> getColumns ();
222229
223230 if (count ($ referencedColumns ) > 1 ) {
224231 throw new FluidSchemaException ('You cannot reference a table with a primary key on several columns using FluidSchema. Use DBAL Schema methods instead. ' );
0 commit comments