@@ -350,7 +350,6 @@ public function deleteAttribute(string $collection, string $id, bool $array = fa
350350 */
351351 public function getDocument (Document $ collection , string $ id , array $ queries = [], bool $ forUpdate = false ): Document
352352 {
353- $ spatialAttributes = $ this ->getSpatialAttributes ($ collection );
354353 $ collection = $ collection ->getId ();
355354
356355 $ name = $ this ->filter ($ collection );
@@ -359,9 +358,9 @@ public function getDocument(Document $collection, string $id, array $queries = [
359358 $ forUpdate = $ forUpdate ? 'FOR UPDATE ' : '' ;
360359
361360 $ alias = Query::DEFAULT_ALIAS ;
362- $ spatialAttributes = [];
361+
363362 $ sql = "
364- SELECT {$ this ->getAttributeProjection ($ selections , $ alias, $ spatialAttributes )}
363+ SELECT {$ this ->getAttributeProjection ($ selections , $ alias )}
365364 FROM {$ this ->getSQLTable ($ name )} AS {$ this ->quote ($ alias )}
366365 WHERE {$ this ->quote ($ alias )}. {$ this ->quote ('_uid ' )} = :_uid
367366 {$ this ->getTenantQuery ($ collection , $ alias )}
@@ -1877,37 +1876,13 @@ public function getTenantQuery(
18771876 *
18781877 * @param array<string> $selections
18791878 * @param string $prefix
1880- * @param array<string> $spatialAttributes
1881- * @return mixed
1879+ * @return string
18821880 * @throws Exception
18831881 */
1884- protected function getAttributeProjection (array $ selections , string $ prefix, array $ spatialAttributes = [] ): mixed
1882+ protected function getAttributeProjection (array $ selections , string $ prefix ): string
18851883 {
18861884 if (empty ($ selections ) || \in_array ('* ' , $ selections )) {
1887- if (empty ($ spatialAttributes )) {
1888- return "{$ this ->quote ($ prefix )}.* " ;
1889- }
1890-
1891- $ projections = [];
1892- $ projections [] = "{$ this ->quote ($ prefix )}.* " ;
1893-
1894- $ internalColumns = ['_id ' , '_uid ' , '_createdAt ' , '_updatedAt ' , '_permissions ' ];
1895- if ($ this ->sharedTables ) {
1896- $ internalColumns [] = '_tenant ' ;
1897- }
1898- foreach ($ internalColumns as $ col ) {
1899- $ projections [] = "{$ this ->quote ($ prefix )}. {$ this ->quote ($ col )}" ;
1900- }
1901-
1902- foreach ($ spatialAttributes as $ spatialAttr ) {
1903- $ filteredAttr = $ this ->filter ($ spatialAttr );
1904- $ quotedAttr = $ this ->quote ($ filteredAttr );
1905- $ axisOrder = $ this ->getSupportForSpatialAxisOrder () ? ', ' . $ this ->getSpatialAxisOrderSpec () : '' ;
1906- $ projections [] = "ST_AsText( {$ this ->quote ($ prefix )}. {$ quotedAttr } {$ axisOrder } ) AS {$ quotedAttr }" ;
1907- }
1908-
1909-
1910- return implode (', ' , $ projections );
1885+ return "{$ this ->quote ($ prefix )}.* " ;
19111886 }
19121887
19131888 // Handle specific selections with spatial conversion where needed
@@ -1929,13 +1904,7 @@ protected function getAttributeProjection(array $selections, string $prefix, arr
19291904 foreach ($ selections as $ selection ) {
19301905 $ filteredSelection = $ this ->filter ($ selection );
19311906 $ quotedSelection = $ this ->quote ($ filteredSelection );
1932-
1933- if (in_array ($ selection , $ spatialAttributes )) {
1934- $ axisOrder = $ this ->getSupportForSpatialAxisOrder () ? ', ' . $ this ->getSpatialAxisOrderSpec () : '' ;
1935- $ projections [] = "ST_AsText( {$ this ->quote ($ prefix )}. {$ quotedSelection } {$ axisOrder }) AS {$ quotedSelection }" ;
1936- } else {
1937- $ projections [] = "{$ this ->quote ($ prefix )}. {$ quotedSelection }" ;
1938- }
1907+ $ projections [] = "{$ this ->quote ($ prefix )}. {$ quotedSelection }" ;
19391908 }
19401909
19411910 return \implode (', ' , $ projections );
0 commit comments