Completed
Push — 3.1.1 ( f2fce9...a3e855 )
by
unknown
02:04
created
src/ZohoDatabaseCopier.php 1 patch
Spacing   +14 added lines, -14 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);
@@ -150,15 +150,15 @@  discard block
 block discarded – undo
150 150
                 $tableDetail = $this->connection->getSchemaManager()->listTableDetails($tableName);
151 151
                 $lastActivityTime = null;
152 152
                 if ($tableDetail->hasColumn('modifiedTime')) {
153
-                    $lastActivityTime = $this->connection->fetchColumn('SELECT MAX(modifiedTime) FROM ' . $tableName);
153
+                    $lastActivityTime = $this->connection->fetchColumn('SELECT MAX(modifiedTime) FROM '.$tableName);
154 154
                 }
155 155
                 if (!$lastActivityTime && $tableDetail->hasColumn('createdTime')) {
156
-                    $lastActivityTime = $this->connection->fetchColumn('SELECT MAX(createdTime) FROM ' . $tableName);
156
+                    $lastActivityTime = $this->connection->fetchColumn('SELECT MAX(createdTime) FROM '.$tableName);
157 157
                 }
158 158
 
159 159
                 if ($lastActivityTime !== null) {
160 160
                     $lastActivityTime = new \DateTime($lastActivityTime, new \DateTimeZone($dao->getZohoClient()->getTimezone()));
161
-                    $this->logger->info('Last modified time: ' . $lastActivityTime->format(\DateTime::ATOM));
161
+                    $this->logger->info('Last modified time: '.$lastActivityTime->format(\DateTime::ATOM));
162 162
                     // Let's add one second to the last activity time (otherwise, we are fetching again the last record in DB).
163 163
                     $lastActivityTime->add(new \DateInterval('PT1S'));
164 164
                 }
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
                 $deletedRecords = [];
172 172
             }
173 173
         } catch (ZCRMException $exception) {
174
-            $this->logger->error('Error when getting records for module ' . $tableName . ': ' . $exception->getMessage(), [
174
+            $this->logger->error('Error when getting records for module '.$tableName.': '.$exception->getMessage(), [
175 175
                 'exception' => $exception
176 176
             ]);
177 177
             if ($throwErrors) {
@@ -179,11 +179,11 @@  discard block
 block discarded – undo
179 179
             }
180 180
             return;
181 181
         }
182
-        $this->logger->info('Fetched ' . count($records) . ' records');
182
+        $this->logger->info('Fetched '.count($records).' records');
183 183
 
184 184
         $table = $this->connection->getSchemaManager()->createSchema()->getTable($tableName);
185 185
 
186
-        $select = $this->connection->prepare('SELECT * FROM ' . $tableName . ' WHERE id = :id');
186
+        $select = $this->connection->prepare('SELECT * FROM '.$tableName.' WHERE id = :id');
187 187
 
188 188
         $this->connection->beginTransaction();
189 189
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
             $select->execute(['id' => $record->getZohoId()]);
217 217
             $result = $select->fetch(\PDO::FETCH_ASSOC);
218 218
             if ($result === false) {
219
-                $this->logger->debug("Inserting record with ID '" . $record->getZohoId() . "'.");
219
+                $this->logger->debug("Inserting record with ID '".$record->getZohoId()."'.");
220 220
 
221 221
                 $data['id'] = $record->getZohoId();
222 222
                 $types['id'] = 'string';
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
                     $listener->onInsert($data, $dao);
228 228
                 }
229 229
             } else {
230
-                $this->logger->debug("Updating record with ID '" . $record->getZohoId() . "'.");
230
+                $this->logger->debug("Updating record with ID '".$record->getZohoId()."'.");
231 231
                 $identifier = ['id' => $record->getZohoId()];
232 232
                 $types['id'] = 'string';
233 233
 
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
                 }
241 241
             }
242 242
         }
243
-        $sqlStatementUid = 'select uid from ' . $this->connection->quoteIdentifier($tableName) . ' where id = :id';
243
+        $sqlStatementUid = 'select uid from '.$this->connection->quoteIdentifier($tableName).' where id = :id';
244 244
         foreach ($deletedRecords as $deletedRecord) {
245 245
             $uid = $this->connection->fetchColumn($sqlStatementUid, ['id' => $deletedRecord->getEntityId()]);
246 246
             $this->connection->delete($tableName, ['id' => $deletedRecord->getEntityId()]);
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
                 $this->connection->delete('local_update', ['table_name' => $tableName, 'uid' => $uid]);
252 252
             }
253 253
         }
254
-        $this->logger->info('Deleted ' . count($deletedRecords) . ' records');
254
+        $this->logger->info('Deleted '.count($deletedRecords).' records');
255 255
 
256 256
         $this->connection->commit();
257 257
     }
Please login to merge, or discard this patch.
src/LocalChangesTracker.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         $localDelete = $schema->createTable('local_delete');
50 50
         $localDelete->addColumn('table_name', 'string', ['length' => 100]);
51 51
         $localDelete->addColumn('uid', 'string', ['length' => 36]);
52
-        $localDelete->addColumn('id', 'string', ['length' => 100,'notnull'=>false]);
52
+        $localDelete->addColumn('id', 'string', ['length' => 100, 'notnull'=>false]);
53 53
         $localDelete->setPrimaryKey(array('table_name', 'uid'));
54 54
         $localDelete->addUniqueIndex(['id', 'table_name']);
55 55
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     public function createUuidInsertTrigger(Table $table)
63 63
     {
64 64
         $triggerName = sprintf('TRG_%s_SETUUIDBEFOREINSERT', $table->getName());
65
-        $this->logger->info('Creating ' . $triggerName . ' trigger for table ' . $table->getName() . '...');
65
+        $this->logger->info('Creating '.$triggerName.' trigger for table '.$table->getName().'...');
66 66
 
67 67
         //Fix - temporary MySQL 5.7 strict mode
68 68
         $sql = sprintf(
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     public function createInsertTrigger(Table $table)
92 92
     {
93 93
         $triggerName = sprintf('TRG_%s_ONINSERT', $table->getName());
94
-        $this->logger->info('Creating ' . $triggerName . ' trigger for table ' . $table->getName() . '...');
94
+        $this->logger->info('Creating '.$triggerName.' trigger for table '.$table->getName().'...');
95 95
 
96 96
         $sql = sprintf(
97 97
             '
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
     public function createDeleteTrigger(Table $table)
117 117
     {
118 118
         $triggerName = sprintf('TRG_%s_ONDELETE', $table->getName());
119
-        $this->logger->info('Creating ' . $triggerName . ' trigger for table ' . $table->getName() . '...');
119
+        $this->logger->info('Creating '.$triggerName.' trigger for table '.$table->getName().'...');
120 120
 
121 121
         $sql = sprintf(
122 122
             '
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
     public function createUpdateTrigger(Table $table)
142 142
     {
143 143
         $triggerName = sprintf('TRG_%s_ONUPDATE', $table->getName());
144
-        $this->logger->info('Creating ' . $triggerName . ' trigger for table ' . $table->getName() . '...');
144
+        $this->logger->info('Creating '.$triggerName.' trigger for table '.$table->getName().'...');
145 145
 
146 146
         $innerCode = '';
147 147
 
Please login to merge, or discard this patch.
src/ZohoSyncDatabaseCommand.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
         $this->zohoDatabaseModelSync = $zohoDatabaseModelSync;
102 102
         $this->zohoDatabaseCopier = $zohoDatabaseCopier;
103 103
         $this->zohoDatabaseSync = $zohoDatabaseSync;
104
-        $this->zohoEntitiesGenerator =  $zohoEntitiesGenerator;
104
+        $this->zohoEntitiesGenerator = $zohoEntitiesGenerator;
105 105
         $this->zohoClient = $zohoClient;
106 106
         $this->pathZohoDaos = $pathZohoDaos;
107 107
         $this->namespaceZohoDaos = $namespaceZohoDaos;
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
             if ($input->getOption('log-path') && $input->getOption('clear-logs')) {
139 139
                 $this->logger->notice('Clearing logs...');
140 140
                 $path = $input->getOption('log-path');
141
-                $logFile = $path . '/ZCRMClientLibrary.log';
141
+                $logFile = $path.'/ZCRMClientLibrary.log';
142 142
                 if (file_exists($logFile)) {
143 143
                     if (is_writable($logFile)) {
144 144
                         if (file_put_contents($logFile, '') === false) {
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
                 }
153 153
             }
154 154
 
155
-            if(!$input->getOption('limit')) {
155
+            if (!$input->getOption('limit')) {
156 156
                 ini_set('memory_limit', '-1');
157 157
             }
158 158
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
             if ($input->getOption('log-path') && $input->getOption('dump-logs')) {
178 178
                 $this->logger->info('Dumping logs...');
179 179
                 $path = $input->getOption('log-path');
180
-                $logFile = $path . '/ZCRMClientLibrary.log';
180
+                $logFile = $path.'/ZCRMClientLibrary.log';
181 181
                 if (file_exists($logFile)) {
182 182
                     if (is_readable($logFile)) {
183 183
                         $this->logger->info(file_get_contents($logFile));
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
     {
292 292
         $this->logger->notice('Starting to push data from local database into Zoho CRM...');
293 293
         foreach ($this->zohoDaos as $zohoDao) {
294
-            if($zohoDao->getFieldFromFieldName('createdTime')) {
294
+            if ($zohoDao->getFieldFromFieldName('createdTime')) {
295 295
                 $this->zohoDatabaseSync->pushToZoho($zohoDao);
296 296
             }
297 297
         }
Please login to merge, or discard this patch.