|
@@ -116,19 +116,19 @@ |
|
|
block discarded – undo |
|
116
|
116
|
$zohoDao->save($zohoBeans); |
|
117
|
117
|
if (!$update) { |
|
118
|
118
|
foreach ($zohoBeans as $uid => $zohoBean) { |
|
119
|
|
- $countResult = $this->connection->fetchColumn('select count(id) from '.$tableName.' where id = :id',['id'=>$zohoBean->getZohoId()]); |
|
|
119
|
+ $countResult = $this->connection->fetchColumn('select count(id) from '.$tableName.' where id = :id', ['id'=>$zohoBean->getZohoId()]); |
|
120
|
120
|
//If the sent data were duplicates Zoho can merged so we need to check if the Zoho ID already exist. |
|
121
|
|
- if($countResult === 0) { |
|
|
121
|
+ if ($countResult === 0) { |
|
122
|
122
|
// ID not exist we can update the new row with the Zoho ID |
|
123
|
123
|
$this->connection->beginTransaction(); |
|
124
|
124
|
$this->connection->update($tableName, ['id' => $zohoBean->getZohoId()], ['uid' => $uid]); |
|
125
|
|
- $this->connection->delete('local_insert', ['table_name'=>$tableName, 'uid' => $uid ]); |
|
|
125
|
+ $this->connection->delete('local_insert', ['table_name'=>$tableName, 'uid' => $uid]); |
|
126
|
126
|
$this->connection->commit(); |
|
127
|
127
|
} else { |
|
128
|
128
|
//ID already exist we need to delete the duplicate row. |
|
129
|
129
|
$this->connection->beginTransaction(); |
|
130
|
|
- $this->connection->delete($tableName, ['uid' => $uid ]); |
|
131
|
|
- $this->connection->delete('local_insert', ['table_name'=>$tableName, 'uid' => $uid ]); |
|
|
130
|
+ $this->connection->delete($tableName, ['uid' => $uid]); |
|
|
131
|
+ $this->connection->delete('local_insert', ['table_name'=>$tableName, 'uid' => $uid]); |
|
132
|
132
|
$this->connection->commit(); |
|
133
|
133
|
|
|
134
|
134
|
} |