Completed
Push — 3.1.1 ( 47adc0...1a4355 )
by
unknown
01:41
created
src/ZohoDatabaseCopier.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -71,11 +71,11 @@  discard block
 block discarded – undo
71 71
     {
72 72
         $users = $this->zohoUserService->getUsers();
73 73
         $tableName = 'users';
74
-        $this->logger->info('Fetched ' . count($users) . ' records');
74
+        $this->logger->info('Fetched '.count($users).' records');
75 75
 
76 76
         $table = $this->connection->getSchemaManager()->createSchema()->getTable($tableName);
77 77
 
78
-        $select = $this->connection->prepare('SELECT * FROM ' . $tableName . ' WHERE id = :id');
78
+        $select = $this->connection->prepare('SELECT * FROM '.$tableName.' WHERE id = :id');
79 79
 
80 80
         $this->connection->beginTransaction();
81 81
         foreach ($users as $user) {
@@ -112,14 +112,14 @@  discard block
 block discarded – undo
112 112
             $select->execute(['id' => $user->getId()]);
113 113
             $result = $select->fetch(\PDO::FETCH_ASSOC);
114 114
             if ($result === false && $data) {
115
-                $this->logger->debug("Inserting record with ID '" . $user->getId() . "'.");
115
+                $this->logger->debug("Inserting record with ID '".$user->getId()."'.");
116 116
 
117 117
                 $data['id'] = $user->getId();
118 118
                 $types['id'] = 'string';
119 119
 
120 120
                 $this->connection->insert($tableName, $data, $types);
121 121
             } elseif ($data) {
122
-                $this->logger->debug("Updating record with ID '" . $user->getId() . "'.");
122
+                $this->logger->debug("Updating record with ID '".$user->getId()."'.");
123 123
                 $identifier = ['id' => $user->getId()];
124 124
                 $types['id'] = 'string';
125 125
                 $this->connection->update($tableName, $data, $identifier, $types);
@@ -149,10 +149,10 @@  discard block
 block discarded – undo
149 149
                 $tableDetail = $this->connection->getSchemaManager()->listTableDetails($tableName);
150 150
                 $lastActivityTime = null;
151 151
                 if ($tableDetail->hasColumn('modifiedTime')) {
152
-                    $lastActivityTime = $this->connection->fetchColumn('SELECT MAX(modifiedTime) FROM ' . $tableName);
152
+                    $lastActivityTime = $this->connection->fetchColumn('SELECT MAX(modifiedTime) FROM '.$tableName);
153 153
                 }
154 154
                 if (!$lastActivityTime && $tableDetail->hasColumn('createdTime')) {
155
-                    $lastActivityTime = $this->connection->fetchColumn('SELECT MAX(createdTime) FROM ' . $tableName);
155
+                    $lastActivityTime = $this->connection->fetchColumn('SELECT MAX(createdTime) FROM '.$tableName);
156 156
                 }
157 157
 
158 158
                 if ($lastActivityTime !== null) {
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
                 }
163 163
 
164 164
                 if ($lastActivityTime) {
165
-                    $this->logger->info('Incremental copy from ' . $lastActivityTime->format(\DateTime::ATOM) . ' started');
165
+                    $this->logger->info('Incremental copy from '.$lastActivityTime->format(\DateTime::ATOM).' started');
166 166
                 } else {
167 167
                     $this->logger->info('Incremental copy started');
168 168
                 }
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
                 $deletedRecords = [];
179 179
             }
180 180
         } catch (ZCRMException $exception) {
181
-            $this->logger->error('Error when getting records for module ' . $tableName . ': ' . $exception->getMessage(), [
181
+            $this->logger->error('Error when getting records for module '.$tableName.': '.$exception->getMessage(), [
182 182
                 'exception' => $exception
183 183
             ]);
184 184
             if ($throwErrors) {
@@ -186,11 +186,11 @@  discard block
 block discarded – undo
186 186
             }
187 187
             return;
188 188
         }
189
-        $this->logger->info('Inserting/updating ' . count($records) . ' records...');
189
+        $this->logger->info('Inserting/updating '.count($records).' records...');
190 190
 
191 191
         $table = $this->connection->getSchemaManager()->createSchema()->getTable($tableName);
192 192
 
193
-        $select = $this->connection->prepare('SELECT * FROM ' . $tableName . ' WHERE id = :id');
193
+        $select = $this->connection->prepare('SELECT * FROM '.$tableName.' WHERE id = :id');
194 194
 
195 195
         $this->connection->beginTransaction();
196 196
 
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
             $select->execute(['id' => $record->getZohoId()]);
229 229
             $result = $select->fetch(\PDO::FETCH_ASSOC);
230 230
             if ($result === false) {
231
-                $this->logger->debug("Inserting record with ID '" . $record->getZohoId() . "'...");
231
+                $this->logger->debug("Inserting record with ID '".$record->getZohoId()."'...");
232 232
 
233 233
                 $data['id'] = $record->getZohoId();
234 234
                 $types['id'] = 'string';
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
                     $listener->onInsert($data, $dao);
240 240
                 }
241 241
             } else {
242
-                $this->logger->debug("Updating record with ID '" . $record->getZohoId() . "'...");
242
+                $this->logger->debug("Updating record with ID '".$record->getZohoId()."'...");
243 243
                 $identifier = ['id' => $record->getZohoId()];
244 244
                 $types['id'] = 'string';
245 245
 
@@ -253,10 +253,10 @@  discard block
 block discarded – undo
253 253
             }
254 254
         }
255 255
 
256
-        $this->logger->info('Deleting ' . count($deletedRecords) . ' records...');
257
-        $sqlStatementUid = 'select uid from ' . $this->connection->quoteIdentifier($tableName) . ' where id = :id';
256
+        $this->logger->info('Deleting '.count($deletedRecords).' records...');
257
+        $sqlStatementUid = 'select uid from '.$this->connection->quoteIdentifier($tableName).' where id = :id';
258 258
         foreach ($deletedRecords as $deletedRecord) {
259
-            $this->logger->debug("Deleting record with ID '" . $deletedRecord->getEntityId() . "'...");
259
+            $this->logger->debug("Deleting record with ID '".$deletedRecord->getEntityId()."'...");
260 260
             $uid = $this->connection->fetchColumn($sqlStatementUid, ['id' => $deletedRecord->getEntityId()]);
261 261
             $recordsModificationCounts['delete'] += $this->connection->delete($tableName, ['id' => $deletedRecord->getEntityId()]);
262 262
             if ($twoWaysSync) {
Please login to merge, or discard this patch.