66
77namespace Hostnet \Component \AccessorGenerator \AnnotationProcessor ;
88
9- use Doctrine \DBAL \Types \Type ;
9+ use Doctrine \DBAL \Types \Types ;
1010use Doctrine \ORM \Mapping \Column ;
1111use Doctrine \ORM \Mapping \GeneratedValue ;
1212use Doctrine \ORM \Mapping \JoinColumn ;
@@ -27,7 +27,11 @@ class DoctrineAnnotationProcessor implements AnnotationProcessorInterface
2727 private const ZEROED_DATE_TIME = 'zeroeddatetime ' ;
2828 private const ZEROED_DATE = 'zeroeddate ' ;
2929 private const YAML_ARRAY = 'yaml_array ' ;
30- private const NULLABLE_TYPES = [self ::ZEROED_DATE , self ::ZEROED_DATE_TIME ];
30+ /**
31+ * @deprecated since doctrine/dbal:2.6
32+ */
33+ private const JSON_ARRAY = 'json_array ' ;
34+ private const NULLABLE_TYPES = [self ::ZEROED_DATE , self ::ZEROED_DATE_TIME ];
3135
3236 /**
3337 * Process annotations of type:
@@ -156,7 +160,7 @@ private function processBidirectional($annotation, PropertyInformation $informat
156160 protected function processColumn (Column $ column , PropertyInformation $ information ): void
157161 {
158162 $ information ->setType ($ this ->transformType ($ column ->type ));
159- $ information ->setFixedPointNumber (strtolower ($ column ->type ) === Type ::DECIMAL );
163+ $ information ->setFixedPointNumber (strtolower ($ column ->type ) === Types ::DECIMAL );
160164 $ information ->setLength ($ column ->length ?: 0 );
161165 $ information ->setPrecision ($ column ->precision );
162166 $ information ->setScale ($ column ->scale );
@@ -214,43 +218,50 @@ private function processJoinColumn(JoinColumn $join_column, PropertyInformation
214218 */
215219 private function transformType ($ type )
216220 {
217- if ($ type === Type ::BOOLEAN ) {
221+ if ($ type === Types ::BOOLEAN ) {
218222 return 'boolean ' ;
219223 }
220224
221- if ($ type === Type ::SMALLINT || $ type === Type ::BIGINT || $ type === Type ::INTEGER ) {
225+ if ($ type === Types ::SMALLINT || $ type === Types ::BIGINT || $ type === Types ::INTEGER ) {
222226 return 'integer ' ;
223227 }
224228
225- if ($ type === Type ::FLOAT ) {
229+ if ($ type === Types ::FLOAT ) {
226230 return 'float ' ;
227231 }
228232
229- if ($ type === Type ::TEXT || $ type === Type ::GUID || $ type === Type ::STRING || $ type === Type ::DECIMAL ) {
233+ if ($ type === Types ::TEXT || $ type === Types ::GUID || $ type === Types ::STRING || $ type === Types ::DECIMAL ) {
230234 return 'string ' ;
231235 }
232236
233- if ($ type === Type ::BLOB /* binary will be added in doctrine 2.5 */ ) {
237+ if ($ type === Types ::BLOB /* binary will be added in doctrine 2.5 */ ) {
234238 return 'resource ' ;
235239 }
236240
237241 if (\in_array (
238242 $ type ,
239- [Type::DATETIME , Type::DATETIMETZ , Type::DATE , Type::TIME , self ::ZEROED_DATE_TIME , self ::ZEROED_DATE ],
243+ [
244+ Types::DATETIME_MUTABLE ,
245+ Types::DATETIMETZ_MUTABLE ,
246+ Types::DATE_MUTABLE ,
247+ Types::TIME_MUTABLE ,
248+ self ::ZEROED_DATE_TIME ,
249+ self ::ZEROED_DATE ,
250+ ],
240251 true
241252 )) {
242253 return '\\' . \DateTime::class;
243254 }
244255
245256 if (\in_array (
246257 $ type ,
247- [Type ::SIMPLE_ARRAY , Type ::JSON_ARRAY , Type ::JSON , Type:: TARRAY , self ::YAML_ARRAY ],
258+ [Types ::SIMPLE_ARRAY , self ::JSON_ARRAY , Types ::JSON , Types:: ARRAY , self ::YAML_ARRAY ],
248259 true
249260 )) {
250261 return 'array ' ;
251262 }
252263
253- if ($ type === Type ::OBJECT ) {
264+ if ($ type === Types ::OBJECT ) {
254265 return 'object ' ;
255266 }
256267
0 commit comments