From 3e473bfc0b2a1634d4cc0e224fd8bf274ca49d01 Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Tue, 25 Aug 2020 08:55:40 -0400
Subject: [PATCH] Use SQL_STAR constant for clarity. (#1690)

---
 module/VuFind/src/VuFind/Db/Row/Tags.php           | 3 ++-
 module/VuFind/src/VuFind/Db/Row/User.php           | 3 ++-
 module/VuFind/src/VuFind/Db/Table/Comments.php     | 3 ++-
 module/VuFind/src/VuFind/Db/Table/Resource.php     | 3 ++-
 module/VuFind/src/VuFind/Db/Table/ResourceTags.php | 3 ++-
 module/VuFind/src/VuFind/Db/Table/Tags.php         | 2 +-
 module/VuFind/src/VuFind/Db/Table/UserList.php     | 3 ++-
 module/VuFind/src/VuFind/Db/Table/UserResource.php | 3 ++-
 8 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/module/VuFind/src/VuFind/Db/Row/Tags.php b/module/VuFind/src/VuFind/Db/Row/Tags.php
index 897653c9787..06944844c7e 100644
--- a/module/VuFind/src/VuFind/Db/Row/Tags.php
+++ b/module/VuFind/src/VuFind/Db/Row/Tags.php
@@ -28,6 +28,7 @@
 namespace VuFind\Db\Row;
 
 use Laminas\Db\Sql\Expression;
+use Laminas\Db\Sql\Select;
 use VuFind\Db\Table\Resource as ResourceTable;
 
 /**
@@ -74,7 +75,7 @@ class Tags extends RowGateway implements \VuFind\Db\Table\DbTableAwareInterface
                     new Expression(
                         'DISTINCT(?)', ['resource.id'],
                         [Expression::TYPE_IDENTIFIER]
-                    ), '*'
+                    ), Select::SQL_STAR
                 ]
             );
             $select->join(
diff --git a/module/VuFind/src/VuFind/Db/Row/User.php b/module/VuFind/src/VuFind/Db/Row/User.php
index d73270b45af..90ad512c4ac 100644
--- a/module/VuFind/src/VuFind/Db/Row/User.php
+++ b/module/VuFind/src/VuFind/Db/Row/User.php
@@ -30,6 +30,7 @@ namespace VuFind\Db\Row;
 use Laminas\Crypt\BlockCipher as BlockCipher;
 use Laminas\Crypt\Symmetric\Openssl;
 use Laminas\Db\Sql\Expression;
+use Laminas\Db\Sql\Select;
 
 /**
  * Row Definition for user
@@ -338,7 +339,7 @@ class User extends RowGateway implements \VuFind\Db\Table\DbTableAwareInterface,
         $callback = function ($select) use ($userId) {
             $select->columns(
                 [
-                    '*',
+                    Select::SQL_STAR,
                     'cnt' => new Expression(
                         'COUNT(DISTINCT(?))', ['ur.resource_id'],
                         [Expression::TYPE_IDENTIFIER]
diff --git a/module/VuFind/src/VuFind/Db/Table/Comments.php b/module/VuFind/src/VuFind/Db/Table/Comments.php
index 13d170d73a4..b9c3a79958e 100644
--- a/module/VuFind/src/VuFind/Db/Table/Comments.php
+++ b/module/VuFind/src/VuFind/Db/Table/Comments.php
@@ -29,6 +29,7 @@ namespace VuFind\Db\Table;
 
 use Laminas\Db\Adapter\Adapter;
 use Laminas\Db\Sql\Expression;
+use Laminas\Db\Sql\Select;
 use VuFind\Db\Row\RowGateway;
 
 /**
@@ -74,7 +75,7 @@ class Comments extends Gateway
         }
 
         $callback = function ($select) use ($resource) {
-            $select->columns(['*']);
+            $select->columns([Select::SQL_STAR]);
             $select->join(
                 ['u' => 'user'], 'u.id = comments.user_id',
                 ['firstname', 'lastname'],
diff --git a/module/VuFind/src/VuFind/Db/Table/Resource.php b/module/VuFind/src/VuFind/Db/Table/Resource.php
index 966cd63da04..aeebe47d57d 100644
--- a/module/VuFind/src/VuFind/Db/Table/Resource.php
+++ b/module/VuFind/src/VuFind/Db/Table/Resource.php
@@ -29,6 +29,7 @@ namespace VuFind\Db\Table;
 
 use Laminas\Db\Adapter\Adapter;
 use Laminas\Db\Sql\Expression;
+use Laminas\Db\Sql\Select;
 use VuFind\Date\Converter as DateConverter;
 use VuFind\Db\Row\RowGateway;
 use VuFind\Record\Loader;
@@ -163,7 +164,7 @@ class Resource extends Gateway
                         new Expression(
                             'DISTINCT(?)', ['resource.id'],
                             [Expression::TYPE_IDENTIFIER]
-                        ), '*'
+                        ), Select::SQL_STAR
                     ]
                 );
                 $s->join(
diff --git a/module/VuFind/src/VuFind/Db/Table/ResourceTags.php b/module/VuFind/src/VuFind/Db/Table/ResourceTags.php
index a0df30a8695..46874669d08 100644
--- a/module/VuFind/src/VuFind/Db/Table/ResourceTags.php
+++ b/module/VuFind/src/VuFind/Db/Table/ResourceTags.php
@@ -29,6 +29,7 @@ namespace VuFind\Db\Table;
 
 use Laminas\Db\Adapter\Adapter;
 use Laminas\Db\Sql\Expression;
+use Laminas\Db\Sql\Select;
 use VuFind\Db\Row\RowGateway;
 
 /**
@@ -166,7 +167,7 @@ class ResourceTags extends Gateway
                     'resource_id' => new Expression(
                         'DISTINCT(?)', ['resource_tags.resource_id'],
                         [Expression::TYPE_IDENTIFIER]
-                    ), '*'
+                    ), Select::SQL_STAR
                 ]
             );
             $select->join(
diff --git a/module/VuFind/src/VuFind/Db/Table/Tags.php b/module/VuFind/src/VuFind/Db/Table/Tags.php
index cb64f486518..b052ba85e9c 100644
--- a/module/VuFind/src/VuFind/Db/Table/Tags.php
+++ b/module/VuFind/src/VuFind/Db/Table/Tags.php
@@ -149,7 +149,7 @@ class Tags extends Gateway
             $select->join(
                 ['resource' => 'resource'],
                 'rt.resource_id = resource.id',
-                '*'
+                Select::SQL_STAR
             );
             if ($fuzzy) {
                 $select->where->literal('lower(tags.tag) like lower(?)', [$q]);
diff --git a/module/VuFind/src/VuFind/Db/Table/UserList.php b/module/VuFind/src/VuFind/Db/Table/UserList.php
index 512f8d43aa5..492ba46f132 100644
--- a/module/VuFind/src/VuFind/Db/Table/UserList.php
+++ b/module/VuFind/src/VuFind/Db/Table/UserList.php
@@ -29,6 +29,7 @@ namespace VuFind\Db\Table;
 
 use Laminas\Db\Adapter\Adapter;
 use Laminas\Db\Sql\Expression;
+use Laminas\Db\Sql\Select;
 use Laminas\Session\Container;
 use VuFind\Db\Row\RowGateway;
 use VuFind\Exception\LoginRequired as LoginRequiredException;
@@ -128,7 +129,7 @@ class UserList extends Gateway
                     new Expression(
                         'DISTINCT(?)', ['user_list.id'],
                         [Expression::TYPE_IDENTIFIER]
-                    ), '*'
+                    ), Select::SQL_STAR
                 ]
             );
             $select->join(
diff --git a/module/VuFind/src/VuFind/Db/Table/UserResource.php b/module/VuFind/src/VuFind/Db/Table/UserResource.php
index 52a242783cd..a250c3cb3b0 100644
--- a/module/VuFind/src/VuFind/Db/Table/UserResource.php
+++ b/module/VuFind/src/VuFind/Db/Table/UserResource.php
@@ -29,6 +29,7 @@ namespace VuFind\Db\Table;
 
 use Laminas\Db\Adapter\Adapter;
 use Laminas\Db\Sql\Expression;
+use Laminas\Db\Sql\Select;
 use VuFind\Db\Row\RowGateway;
 
 /**
@@ -78,7 +79,7 @@ class UserResource extends Gateway
                     new Expression(
                         'DISTINCT(?)', ['user_resource.id'],
                         [Expression::TYPE_IDENTIFIER]
-                    ), '*'
+                    ), Select::SQL_STAR
                 ]
             );
             $select->join(
-- 
GitLab