@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | $this->logger = $logger; |
| 47 | 47 | } |
| 48 | 48 | $this->apiLimitInsertUpdateDelete = $apiLimitInsertUpdateDelete; |
| 49 | - if($apiLimitInsertUpdateDelete === null){ |
|
| 49 | + if ($apiLimitInsertUpdateDelete === null) { |
|
| 50 | 50 | $this->apiLimitInsertUpdateDelete = 100; |
| 51 | 51 | } |
| 52 | 52 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | $localTable = $update ? 'local_update' : 'local_insert'; |
| 100 | 100 | $fieldsMatching = $this->findMethodValues($zohoDao); |
| 101 | 101 | $tableName = ZohoDatabaseHelper::getTableName($zohoDao, $this->prefix); |
| 102 | - do{ |
|
| 102 | + do { |
|
| 103 | 103 | $rowsDeleted = []; |
| 104 | 104 | //@see https://www.zoho.com/crm/help/api/api-limits.html |
| 105 | 105 | //To optimize your API usage, get maximum 200 records with each request and insert, update or delete maximum 100 records with each request. |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | $statement->addSelect('l.field_name as updated_fieldname'); |
| 113 | 113 | } |
| 114 | 114 | $statement->from($localTable, 'l') |
| 115 | - ->join('l','('.$statementLimiter->getSQL().')','ll','ll.table_name = l.table_name and ll.uid = l.uid') |
|
| 115 | + ->join('l', '('.$statementLimiter->getSQL().')', 'll', 'll.table_name = l.table_name and ll.uid = l.uid') |
|
| 116 | 116 | ->join('l', $tableName, 'zcrm', 'zcrm.uid = l.uid') |
| 117 | 117 | ->where('l.table_name=:table_name') |
| 118 | 118 | ->setParameters([ |
@@ -144,9 +144,9 @@ discard block |
||
| 144 | 144 | $rowsDeleted[] = $row['uid']; |
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | - $this->sendDataToZohoCleanLocal($zohoDao,$zohoBeans,$rowsDeleted,$update); |
|
| 148 | - $countToPush = $this->countElementInTable($zohoDao,$update); |
|
| 149 | - } while($countToPush > 0); |
|
| 147 | + $this->sendDataToZohoCleanLocal($zohoDao, $zohoBeans, $rowsDeleted, $update); |
|
| 148 | + $countToPush = $this->countElementInTable($zohoDao, $update); |
|
| 149 | + } while ($countToPush > 0); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | /** |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | * @param string[] $rowsDeleted |
| 156 | 156 | * @param bool $update |
| 157 | 157 | */ |
| 158 | - private function sendDataToZohoCleanLocal(AbstractZohoDao $zohoDao, array $zohoBeans,$rowsDeleted, $update = false) |
|
| 158 | + private function sendDataToZohoCleanLocal(AbstractZohoDao $zohoDao, array $zohoBeans, $rowsDeleted, $update = false) |
|
| 159 | 159 | { |
| 160 | 160 | $tableName = ZohoDatabaseHelper::getTableName($zohoDao, $this->prefix); |
| 161 | 161 | // $zohoDao->save($zohoBeans); |
@@ -167,13 +167,13 @@ discard block |
||
| 167 | 167 | // ID not exist we can update the new row with the Zoho ID |
| 168 | 168 | $this->connection->beginTransaction(); |
| 169 | 169 | $this->connection->update($tableName, ['id' => $zohoBean->getZohoId()], ['uid' => $uid]); |
| 170 | - $this->connection->delete('local_insert', ['table_name'=>$tableName, 'uid' => $uid ]); |
|
| 170 | + $this->connection->delete('local_insert', ['table_name'=>$tableName, 'uid' => $uid]); |
|
| 171 | 171 | $this->connection->commit(); |
| 172 | 172 | } else { |
| 173 | 173 | //ID already exist we need to delete the duplicate row. |
| 174 | 174 | $this->connection->beginTransaction(); |
| 175 | - $this->connection->delete($tableName, ['uid' => $uid ]); |
|
| 176 | - $this->connection->delete('local_insert', ['table_name'=>$tableName, 'uid' => $uid ]); |
|
| 175 | + $this->connection->delete($tableName, ['uid' => $uid]); |
|
| 176 | + $this->connection->delete('local_insert', ['table_name'=>$tableName, 'uid' => $uid]); |
|
| 177 | 177 | $this->connection->commit(); |
| 178 | 178 | } |
| 179 | 179 | } |