@@ -86,15 +86,15 @@ discard block |
||
86 | 86 | |
87 | 87 | $flatFields = ZohoDatabaseHelper::getFlatFields($dao->getFields()); |
88 | 88 | //@Temporary fix to use Mysql5.7 not strict |
89 | - $table->addColumn('uid', 'string', ['length' => 36,'notnull'=>false]); |
|
90 | - $table->addColumn('id', 'string', ['length' => 100,'notnull'=>false]); |
|
89 | + $table->addColumn('uid', 'string', ['length' => 36, 'notnull'=>false]); |
|
90 | + $table->addColumn('id', 'string', ['length' => 100, 'notnull'=>false]); |
|
91 | 91 | $table->addUniqueIndex(['id']); |
92 | 92 | $table->setPrimaryKey(['uid']); |
93 | 93 | |
94 | 94 | foreach ($flatFields as $field) { |
95 | 95 | $columnName = $field['name']; |
96 | 96 | //It seems sometime we can have the same field twice in the list of fields from the API. |
97 | - if($table->hasColumn($columnName)){ |
|
97 | + if ($table->hasColumn($columnName)) { |
|
98 | 98 | continue; |
99 | 99 | } |
100 | 100 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | $table = $schema->createTable($tableName); |
203 | 203 | |
204 | 204 | $flatFields = $users->getUserFields(); |
205 | - $table->addColumn('id', 'string', ['length' => 100,'notnull'=>false]); |
|
205 | + $table->addColumn('id', 'string', ['length' => 100, 'notnull'=>false]); |
|
206 | 206 | $table->setPrimaryKey(['id']); |
207 | 207 | foreach ($flatFields as $field) { |
208 | 208 | if (in_array($field, ['id'])) { |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | //To optimize your API usage, get maximum 200 records with each request and insert, update or delete maximum 100 records with each request. |
127 | 127 | $offsetTodo = 0; |
128 | 128 | $doneBeans = 0; |
129 | - while($doneBeans < $countItems){ |
|
130 | - $zohoBeansToSend = array_slice($zohoBeans,$offsetTodo,$this->apiLimitInsertUpdateDelete,true); |
|
129 | + while ($doneBeans < $countItems) { |
|
130 | + $zohoBeansToSend = array_slice($zohoBeans, $offsetTodo, $this->apiLimitInsertUpdateDelete, true); |
|
131 | 131 | $offsetTodo += $this->apiLimitInsertUpdateDelete; |
132 | 132 | $doneBeans += count($zohoBeansToSend); |
133 | 133 | } |
@@ -140,13 +140,13 @@ discard block |
||
140 | 140 | // ID not exist we can update the new row with the Zoho ID |
141 | 141 | $this->connection->beginTransaction(); |
142 | 142 | $this->connection->update($tableName, ['id' => $zohoBean->getZohoId()], ['uid' => $uid]); |
143 | - $this->connection->delete('local_insert', ['table_name'=>$tableName, 'uid' => $uid ]); |
|
143 | + $this->connection->delete('local_insert', ['table_name'=>$tableName, 'uid' => $uid]); |
|
144 | 144 | $this->connection->commit(); |
145 | 145 | } else { |
146 | 146 | //ID already exist we need to delete the duplicate row. |
147 | 147 | $this->connection->beginTransaction(); |
148 | - $this->connection->delete($tableName, ['uid' => $uid ]); |
|
149 | - $this->connection->delete('local_insert', ['table_name'=>$tableName, 'uid' => $uid ]); |
|
148 | + $this->connection->delete($tableName, ['uid' => $uid]); |
|
149 | + $this->connection->delete('local_insert', ['table_name'=>$tableName, 'uid' => $uid]); |
|
150 | 150 | $this->connection->commit(); |
151 | 151 | } |
152 | 152 | } |
@@ -129,9 +129,9 @@ |
||
129 | 129 | // Let's get the last modification date: |
130 | 130 | $tableDetail = $this->connection->getSchemaManager()->listTableDetails($tableName); |
131 | 131 | //We use createdTime instead of lastActivityTime when the field doesn't exist in order to follow changes. |
132 | - if($tableDetail->hasColumn('lastActivityTime')){ |
|
132 | + if ($tableDetail->hasColumn('lastActivityTime')) { |
|
133 | 133 | $lastActivityTime = $this->connection->fetchColumn('SELECT MAX(lastActivityTime) FROM '.$tableName); |
134 | - } else{ |
|
134 | + } else { |
|
135 | 135 | $lastActivityTime = $this->connection->fetchColumn('SELECT MAX(createdTime) FROM '.$tableName); |
136 | 136 | } |
137 | 137 | if ($lastActivityTime !== null) { |