@@ -71,11 +71,11 @@ discard block |
||
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 |
||
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); |
@@ -151,10 +151,10 @@ discard block |
||
151 | 151 | $tableDetail = $this->connection->getSchemaManager()->listTableDetails($tableName); |
152 | 152 | $lastActivityTime = null; |
153 | 153 | if ($tableDetail->hasColumn('modifiedTime')) { |
154 | - $lastActivityTime = $this->connection->fetchColumn('SELECT MAX(modifiedTime) FROM ' . $tableName); |
|
154 | + $lastActivityTime = $this->connection->fetchColumn('SELECT MAX(modifiedTime) FROM '.$tableName); |
|
155 | 155 | } |
156 | 156 | if (!$lastActivityTime && $tableDetail->hasColumn('createdTime')) { |
157 | - $lastActivityTime = $this->connection->fetchColumn('SELECT MAX(createdTime) FROM ' . $tableName); |
|
157 | + $lastActivityTime = $this->connection->fetchColumn('SELECT MAX(createdTime) FROM '.$tableName); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | if ($lastActivityTime !== null) { |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | } |
165 | 165 | |
166 | 166 | if ($lastActivityTime) { |
167 | - $this->logger->info('Incremental copy from ' . $lastActivityTime->format(\DateTime::ATOM) . ' started'); |
|
167 | + $this->logger->info('Incremental copy from '.$lastActivityTime->format(\DateTime::ATOM).' started'); |
|
168 | 168 | } else { |
169 | 169 | $this->logger->info('Incremental copy started'); |
170 | 170 | } |
@@ -172,21 +172,21 @@ discard block |
||
172 | 172 | $this->logger->info('Fetching the records to insert/update...'); |
173 | 173 | $records = $dao->getRecords(null, null, null, $lastActivityTime); |
174 | 174 | $totalRecords = count($records); |
175 | - $this->logger->debug($totalRecords . ' records fetched.'); |
|
175 | + $this->logger->debug($totalRecords.' records fetched.'); |
|
176 | 176 | $this->logger->info('Fetching the records to delete...'); |
177 | 177 | $deletedRecords = $dao->getDeletedRecordIds($lastActivityTime); |
178 | 178 | $totalRecordsDeleted = count($deletedRecords); |
179 | - $this->logger->debug($totalRecordsDeleted . ' records fetched.'); |
|
179 | + $this->logger->debug($totalRecordsDeleted.' records fetched.'); |
|
180 | 180 | } else { |
181 | 181 | $this->logger->info('Full copy started'); |
182 | 182 | $this->logger->info('Fetching the records to insert/update...'); |
183 | 183 | $records = $dao->getRecords(); |
184 | 184 | $totalRecords = count($records); |
185 | - $this->logger->debug($totalRecords . ' records fetched.'); |
|
185 | + $this->logger->debug($totalRecords.' records fetched.'); |
|
186 | 186 | $deletedRecords = []; |
187 | 187 | } |
188 | 188 | } catch (ZCRMException $exception) { |
189 | - $this->logger->error('Error when getting records for module ' . $tableName . ': ' . $exception->getMessage(), [ |
|
189 | + $this->logger->error('Error when getting records for module '.$tableName.': '.$exception->getMessage(), [ |
|
190 | 190 | 'exception' => $exception |
191 | 191 | ]); |
192 | 192 | if ($throwErrors) { |
@@ -194,11 +194,11 @@ discard block |
||
194 | 194 | } |
195 | 195 | return; |
196 | 196 | } |
197 | - $this->logger->info('Inserting/updating ' . $totalRecords . ' records into table ' . $tableName . '...'); |
|
197 | + $this->logger->info('Inserting/updating '.$totalRecords.' records into table '.$tableName.'...'); |
|
198 | 198 | |
199 | 199 | $table = $this->connection->getSchemaManager()->createSchema()->getTable($tableName); |
200 | 200 | |
201 | - $select = $this->connection->prepare('SELECT * FROM ' . $tableName . ' WHERE id = :id'); |
|
201 | + $select = $this->connection->prepare('SELECT * FROM '.$tableName.' WHERE id = :id'); |
|
202 | 202 | |
203 | 203 | $this->connection->beginTransaction(); |
204 | 204 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | $processedRecords = 0; |
213 | 213 | foreach ($records as $record) { |
214 | 214 | if (($processedRecords % $logOffset) === 0) { |
215 | - $this->logger->info($processedRecords . '/' . $totalRecords . ' records processed'); |
|
215 | + $this->logger->info($processedRecords.'/'.$totalRecords.' records processed'); |
|
216 | 216 | } |
217 | 217 | ++$processedRecords; |
218 | 218 | $data = []; |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | $select->execute(['id' => $record->getZohoId()]); |
244 | 244 | $result = $select->fetch(\PDO::FETCH_ASSOC); |
245 | 245 | if ($result === false) { |
246 | - $this->logger->debug("Inserting record with ID '" . $record->getZohoId() . "'..."); |
|
246 | + $this->logger->debug("Inserting record with ID '".$record->getZohoId()."'..."); |
|
247 | 247 | |
248 | 248 | $data['id'] = $record->getZohoId(); |
249 | 249 | $types['id'] = 'string'; |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | $listener->onInsert($data, $dao); |
255 | 255 | } |
256 | 256 | } else { |
257 | - $this->logger->debug("Updating record with ID '" . $record->getZohoId() . "'..."); |
|
257 | + $this->logger->debug("Updating record with ID '".$record->getZohoId()."'..."); |
|
258 | 258 | $identifier = ['id' => $record->getZohoId()]; |
259 | 259 | $types['id'] = 'string'; |
260 | 260 | |
@@ -268,16 +268,16 @@ discard block |
||
268 | 268 | } |
269 | 269 | } |
270 | 270 | |
271 | - $this->logger->info('Deleting ' . $totalRecordsDeleted . ' records into table ' . $tableName . '...'); |
|
272 | - $sqlStatementUid = 'select uid from ' . $this->connection->quoteIdentifier($tableName) . ' where id = :id'; |
|
271 | + $this->logger->info('Deleting '.$totalRecordsDeleted.' records into table '.$tableName.'...'); |
|
272 | + $sqlStatementUid = 'select uid from '.$this->connection->quoteIdentifier($tableName).' where id = :id'; |
|
273 | 273 | $processedRecords = 0; |
274 | 274 | $logOffset = $totalRecordsDeleted >= 500 ? 100 : 50; |
275 | 275 | foreach ($deletedRecords as $deletedRecord) { |
276 | 276 | if (($processedRecords % $logOffset) === 0) { |
277 | - $this->logger->info($processedRecords . '/' . $totalRecordsDeleted . ' records processed'); |
|
277 | + $this->logger->info($processedRecords.'/'.$totalRecordsDeleted.' records processed'); |
|
278 | 278 | } |
279 | 279 | ++$processedRecords; |
280 | - $this->logger->debug("Deleting record with ID '" . $deletedRecord->getEntityId() . "'..."); |
|
280 | + $this->logger->debug("Deleting record with ID '".$deletedRecord->getEntityId()."'..."); |
|
281 | 281 | $uid = $this->connection->fetchColumn($sqlStatementUid, ['id' => $deletedRecord->getEntityId()]); |
282 | 282 | $recordsModificationCounts['delete'] += $this->connection->delete($tableName, ['id' => $deletedRecord->getEntityId()]); |
283 | 283 | if ($twoWaysSync) { |