@@ -48,7 +48,7 @@ class Database
4848 public const VAR_UUID7 = 'uuid7 ' ;
4949
5050 // object type
51- public const TYPE_OBJECT = 'object ' ;
51+ public const VAR_OBJECT = 'object ' ;
5252
5353 // Vector types
5454 public const VAR_VECTOR = 'vector ' ;
@@ -74,7 +74,7 @@ class Database
7474 public const INDEX_UNIQUE = 'unique ' ;
7575 public const INDEX_SPATIAL = 'spatial ' ;
7676 // keeping
77- public const Index_Object = 'object ' ;
77+ public const INDEX_OBJECT = 'object ' ;
7878 public const INDEX_HNSW_EUCLIDEAN = 'hnsw_euclidean ' ;
7979 public const INDEX_HNSW_COSINE = 'hnsw_cosine ' ;
8080 public const INDEX_HNSW_DOT = 'hnsw_dot ' ;
@@ -2016,7 +2016,7 @@ private function validateAttribute(
20162016 case self ::VAR_DATETIME :
20172017 case self ::VAR_RELATIONSHIP :
20182018 break ;
2019- case self ::TYPE_OBJECT :
2019+ case self ::VAR_OBJECT :
20202020 if (!$ this ->adapter ->getSupportForObject ()) {
20212021 throw new DatabaseException ('Object attributes are not supported ' );
20222022 }
@@ -2135,7 +2135,7 @@ protected function validateDefaultTypes(string $type, mixed $default): void
21352135
21362136 if ($ defaultType === 'array ' ) {
21372137 // Spatial types require the array itself
2138- if (!in_array ($ type , Database::SPATIAL_TYPES ) && $ type != Database::TYPE_OBJECT ) {
2138+ if (!in_array ($ type , Database::SPATIAL_TYPES ) && $ type != Database::VAR_OBJECT ) {
21392139 foreach ($ default as $ value ) {
21402140 $ this ->validateDefaultTypes ($ type , $ value );
21412141 }
@@ -2432,7 +2432,7 @@ public function updateAttribute(string $collection, string $id, ?string $type =
24322432 }
24332433 break ;
24342434
2435- case self ::TYPE_OBJECT :
2435+ case self ::VAR_OBJECT :
24362436 if (!$ this ->adapter ->getSupportForObject ()) {
24372437 throw new DatabaseException ('Object attributes are not supported ' );
24382438 }
@@ -2491,7 +2491,7 @@ public function updateAttribute(string $collection, string $id, ?string $type =
24912491 self ::VAR_FLOAT ,
24922492 self ::VAR_BOOLEAN ,
24932493 self ::VAR_DATETIME ,
2494- self ::VAR_RELATIONSHIP . ', ' . self ::TYPE_OBJECT
2494+ self ::VAR_RELATIONSHIP . ', ' . self ::VAR_OBJECT
24952495 ];
24962496 if ($ this ->adapter ->getSupportForVectors ()) {
24972497 $ supportedTypes [] = self ::VAR_VECTOR ;
@@ -3490,14 +3490,14 @@ public function createIndex(string $collection, string $id, string $type, array
34903490 }
34913491 break ;
34923492
3493- case self ::Index_Object :
3493+ case self ::INDEX_OBJECT :
34943494 if (!$ this ->adapter ->getSupportForObject ()) {
34953495 throw new DatabaseException ('Object indexes are not supported ' );
34963496 }
34973497 break ;
34983498
34993499 default :
3500- throw new DatabaseException ('Unknown index type: ' . $ type . '. Must be one of ' . Database::INDEX_KEY . ', ' . Database::INDEX_UNIQUE . ', ' . Database::INDEX_FULLTEXT . ', ' . Database::INDEX_SPATIAL . ', ' . Database::Index_Object . ', ' . Database::INDEX_HNSW_EUCLIDEAN . ', ' . Database::INDEX_HNSW_COSINE . ', ' . Database::INDEX_HNSW_DOT );
3500+ throw new DatabaseException ('Unknown index type: ' . $ type . '. Must be one of ' . Database::INDEX_KEY . ', ' . Database::INDEX_UNIQUE . ', ' . Database::INDEX_FULLTEXT . ', ' . Database::INDEX_SPATIAL . ', ' . Database::INDEX_OBJECT . ', ' . Database::INDEX_HNSW_EUCLIDEAN . ', ' . Database::INDEX_HNSW_COSINE . ', ' . Database::INDEX_HNSW_DOT );
35013501 }
35023502
35033503 /** @var array<Document> $collectionAttributes */
@@ -3529,7 +3529,7 @@ public function createIndex(string $collection, string $id, string $type, array
35293529 }
35303530 }
35313531
3532- if ($ type === self ::Index_Object ) {
3532+ if ($ type === self ::INDEX_OBJECT ) {
35333533 if (count ($ attributes ) !== 1 ) {
35343534 throw new IndexException ('Object index can be created on a single object attribute ' );
35353535 }
@@ -3540,7 +3540,7 @@ public function createIndex(string $collection, string $id, string $type, array
35403540 }
35413541
35423542 $ attributeType = $ indexAttributesWithTypes [$ attr ];
3543- if ($ attributeType !== self ::TYPE_OBJECT ) {
3543+ if ($ attributeType !== self ::VAR_OBJECT ) {
35443544 throw new IndexException ('Object index can only be created on object attributes. Attribute " ' . $ attr . '" is of type " ' . $ attributeType . '" ' );
35453545 }
35463546 }
@@ -7561,7 +7561,7 @@ public function casting(Document $collection, Document $document): Document
75617561 case self ::VAR_FLOAT :
75627562 $ node = (float )$ node ;
75637563 break ;
7564- case self ::TYPE_OBJECT :
7564+ case self ::VAR_OBJECT :
75657565 // Decode JSONB string to array
75667566 if (is_string ($ node )) {
75677567 $ node = json_decode ($ node , true );
0 commit comments