@@ -72,11 +72,11 @@ discard block |
||
| 72 | 72 | { |
| 73 | 73 | $users = $this->zohoUserService->getUsers(); |
| 74 | 74 | $tableName = 'users'; |
| 75 | - $this->logger->info('Fetched ' . count($users) . ' records for table ' . $tableName); |
|
| 75 | + $this->logger->info('Fetched '.count($users).' records for table '.$tableName); |
|
| 76 | 76 | |
| 77 | 77 | $table = $this->connection->getSchemaManager()->createSchema()->getTable($tableName); |
| 78 | 78 | |
| 79 | - $select = $this->connection->prepare('SELECT * FROM ' . $tableName . ' WHERE id = :id'); |
|
| 79 | + $select = $this->connection->prepare('SELECT * FROM '.$tableName.' WHERE id = :id'); |
|
| 80 | 80 | |
| 81 | 81 | $this->connection->beginTransaction(); |
| 82 | 82 | foreach ($users as $user) { |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | $lastPageInConfig = '1'; |
| 183 | 183 | } |
| 184 | 184 | $dateModifiedSince = new \DateTime($lastDateInConfig, new \DateTimeZone($dao->getZohoClient()->getTimezone())); |
| 185 | - $recordsPage = (int)$lastPageInConfig; |
|
| 185 | + $recordsPage = (int) $lastPageInConfig; |
|
| 186 | 186 | } else { |
| 187 | 187 | $findDateByModifiedTime = true; |
| 188 | 188 | } |
@@ -197,10 +197,10 @@ discard block |
||
| 197 | 197 | } else { |
| 198 | 198 | $latestDateValue = null; |
| 199 | 199 | if ($tableHasColumnModifiedTime) { |
| 200 | - $latestDateValue = $this->connection->fetchColumn('SELECT MAX(modifiedTime) FROM ' . $tableName); |
|
| 200 | + $latestDateValue = $this->connection->fetchColumn('SELECT MAX(modifiedTime) FROM '.$tableName); |
|
| 201 | 201 | } |
| 202 | 202 | if (!$latestDateValue && $tableHasColumnCreatedTime) { |
| 203 | - $latestDateValue = $this->connection->fetchColumn('SELECT MAX(createdTime) FROM ' . $tableName); |
|
| 203 | + $latestDateValue = $this->connection->fetchColumn('SELECT MAX(createdTime) FROM '.$tableName); |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | if ($latestDateValue !== null) { |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | try { |
| 254 | 254 | $records = $dao->getRecords(null, $sortColumn, $sortOrder, $dateModifiedSince, $recordsPage, 200, $stopAndhasMoreResults); |
| 255 | 255 | } catch (ZCRMException $exception) { |
| 256 | - $this->logger->error('Error when getting updated records for module ' . $dao->getPluralModuleName() . ' and page ' . $recordsPage . ': ' . $exception->getMessage(), [ |
|
| 256 | + $this->logger->error('Error when getting updated records for module '.$dao->getPluralModuleName().' and page '.$recordsPage.': '.$exception->getMessage(), [ |
|
| 257 | 257 | 'exception' => $exception |
| 258 | 258 | ]); |
| 259 | 259 | if ($throwErrors) { |
@@ -265,17 +265,17 @@ discard block |
||
| 265 | 265 | if ($zohoSyncConfigTableExists) { |
| 266 | 266 | $lastDate = $dateModifiedSince ? $dateModifiedSince->format('Y-m-d H:i:s') : $currentDateTime->format('Y-m-d H:i:s'); |
| 267 | 267 | $this->upsertZohoConfig('FETCH_RECORDS_MODIFIED_SINCE__DATE', $tableName, $lastDate); |
| 268 | - $this->upsertZohoConfig('FETCH_RECORDS_MODIFIED_SINCE__PAGE', $tableName, (string)$recordsPage); |
|
| 268 | + $this->upsertZohoConfig('FETCH_RECORDS_MODIFIED_SINCE__PAGE', $tableName, (string) $recordsPage); |
|
| 269 | 269 | } |
| 270 | 270 | $recordsPage++; |
| 271 | 271 | } else { |
| 272 | 272 | if ($zohoSyncConfigTableExists) { |
| 273 | 273 | $latestDateToSave = $currentDateTime->format('Y-m-d H:i:s'); |
| 274 | 274 | if ($tableHasColumnModifiedTime) { |
| 275 | - $latestDateToSave = $this->connection->fetchColumn('SELECT MAX(modifiedTime) FROM ' . $tableName); |
|
| 275 | + $latestDateToSave = $this->connection->fetchColumn('SELECT MAX(modifiedTime) FROM '.$tableName); |
|
| 276 | 276 | } |
| 277 | 277 | if (!$latestDateToSave && $tableHasColumnCreatedTime) { |
| 278 | - $latestDateToSave = $this->connection->fetchColumn('SELECT MAX(createdTime) FROM ' . $tableName); |
|
| 278 | + $latestDateToSave = $this->connection->fetchColumn('SELECT MAX(createdTime) FROM '.$tableName); |
|
| 279 | 279 | } |
| 280 | 280 | if (!$latestDateToSave) { |
| 281 | 281 | $latestDateToSave = $currentDateTime->format('Y-m-d H:i:s'); |
@@ -285,13 +285,13 @@ discard block |
||
| 285 | 285 | } |
| 286 | 286 | } |
| 287 | 287 | $totalRecords = count($records); |
| 288 | - $this->logger->debug($totalRecords . ' records fetched.'); |
|
| 288 | + $this->logger->debug($totalRecords.' records fetched.'); |
|
| 289 | 289 | |
| 290 | 290 | // Save of the records in db |
| 291 | 291 | $this->logger->info(sprintf('Inserting/updating %s records into table %s...', $totalRecords, $tableName)); |
| 292 | - $select = $this->connection->prepare('SELECT * FROM ' . $tableName . ' WHERE id = :id'); |
|
| 292 | + $select = $this->connection->prepare('SELECT * FROM '.$tableName.' WHERE id = :id'); |
|
| 293 | 293 | $this->connection->beginTransaction(); |
| 294 | - $logOffset = (int)ceil($totalRecords / 4); |
|
| 294 | + $logOffset = (int) ceil($totalRecords / 4); |
|
| 295 | 295 | $processedRecords = 0; |
| 296 | 296 | $dataInsertedInDb = 0; |
| 297 | 297 | $dataUpdatedInDb = 0; |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | |
| 360 | 360 | // If there is some columns updated in local_update, we skip them to avoid Zoho values to overide them |
| 361 | 361 | if ($localUpdateTableExists && $result['uid']) { |
| 362 | - $selectRecordInLocalUpdate = $this->connection->prepare('SELECT field_name FROM local_update WHERE table_name = "' . $tableName . '" AND uid = :uid'); |
|
| 362 | + $selectRecordInLocalUpdate = $this->connection->prepare('SELECT field_name FROM local_update WHERE table_name = "'.$tableName.'" AND uid = :uid'); |
|
| 363 | 363 | $selectRecordInLocalUpdate->execute(['uid' => $result['uid']]); |
| 364 | 364 | $resultsInLocalUpdate = $selectRecordInLocalUpdate->fetchAll(\PDO::FETCH_ASSOC); |
| 365 | 365 | $fieldsUpdated = []; |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | try { |
| 408 | 408 | $deletedRecords = $dao->getDeletedRecordIds($dateModifiedSince, $recordsDeletedPage, 200, $stopAndhasMoreResults); |
| 409 | 409 | } catch (ZCRMException $exception) { |
| 410 | - $this->logger->error('Error when getting deleted records for module ' . $dao->getPluralModuleName() . ' and page ' . $recordsDeletedPage . ': ' . $exception->getMessage(), [ |
|
| 410 | + $this->logger->error('Error when getting deleted records for module '.$dao->getPluralModuleName().' and page '.$recordsDeletedPage.': '.$exception->getMessage(), [ |
|
| 411 | 411 | 'exception' => $exception |
| 412 | 412 | ]); |
| 413 | 413 | if ($throwErrors) { |
@@ -419,13 +419,13 @@ discard block |
||
| 419 | 419 | ++$recordsDeletedPage; |
| 420 | 420 | } |
| 421 | 421 | $totalRecordsDeleted = count($deletedRecords); |
| 422 | - $this->logger->debug($totalRecordsDeleted . ' records fetched.'); |
|
| 422 | + $this->logger->debug($totalRecordsDeleted.' records fetched.'); |
|
| 423 | 423 | |
| 424 | 424 | $this->logger->info(sprintf('Deleting %d records from table %s...', $totalRecordsDeleted, $tableName)); |
| 425 | 425 | $this->connection->beginTransaction(); |
| 426 | - $sqlStatementUid = 'select uid from ' . $this->connection->quoteIdentifier($tableName) . ' where id = :id'; |
|
| 426 | + $sqlStatementUid = 'select uid from '.$this->connection->quoteIdentifier($tableName).' where id = :id'; |
|
| 427 | 427 | $processedRecords = 0; |
| 428 | - $logOffset = (int)ceil($totalRecordsDeleted / 4); |
|
| 428 | + $logOffset = (int) ceil($totalRecordsDeleted / 4); |
|
| 429 | 429 | $dataDeletedInDb = 0; |
| 430 | 430 | if ($totalRecordsDeleted) { |
| 431 | 431 | foreach ($deletedRecords as $deletedRecord) { |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | $table = $this->connection->getSchemaManager()->createSchema()->getTable($tableName); |
| 474 | 474 | $apiModuleName = $dao->getPluralModuleName(); |
| 475 | 475 | |
| 476 | - $this->logger->notice('Starting bulk fetch for module ' . $apiModuleName . '...'); |
|
| 476 | + $this->logger->notice('Starting bulk fetch for module '.$apiModuleName.'...'); |
|
| 477 | 477 | |
| 478 | 478 | $zohoClient = new ZohoClient([ |
| 479 | 479 | 'client_id' => ZOHO_CRM_CLIENT_ID, |
@@ -492,11 +492,11 @@ discard block |
||
| 492 | 492 | $oauthToken = $zohoClient->getZohoOAuthClient()->getAccessToken(ZOHO_CRM_CLIENT_CURRENT_USER_EMAIL); |
| 493 | 493 | |
| 494 | 494 | // Step 1: Create a bulk read job |
| 495 | - $this->logger->info('Creating read job for module ' . $apiModuleName . ' and page ' . $page . '...'); |
|
| 496 | - $response = $client->request('POST', 'https://' . (ZOHO_CRM_SANDBOX === 'true' ? 'sandbox' : 'www') . '.zohoapis.com/crm/bulk/v2/read', [ |
|
| 495 | + $this->logger->info('Creating read job for module '.$apiModuleName.' and page '.$page.'...'); |
|
| 496 | + $response = $client->request('POST', 'https://'.(ZOHO_CRM_SANDBOX === 'true' ? 'sandbox' : 'www').'.zohoapis.com/crm/bulk/v2/read', [ |
|
| 497 | 497 | 'http_errors' => false, |
| 498 | 498 | 'headers' => [ |
| 499 | - 'Authorization' => 'Zoho-oauthtoken ' . $oauthToken |
|
| 499 | + 'Authorization' => 'Zoho-oauthtoken '.$oauthToken |
|
| 500 | 500 | ], |
| 501 | 501 | 'json' => [ |
| 502 | 502 | 'query' => [ |
@@ -514,23 +514,23 @@ discard block |
||
| 514 | 514 | |
| 515 | 515 | // We don't care about the job status right now, it will be checked later |
| 516 | 516 | } else { |
| 517 | - $this->logger->error('Cannot create bulk read query for module ' . $apiModuleName . ': status: ' . $response->getStatusCode() . '. Status: ' . $response->getBody()->getContents()); |
|
| 517 | + $this->logger->error('Cannot create bulk read query for module '.$apiModuleName.': status: '.$response->getStatusCode().'. Status: '.$response->getBody()->getContents()); |
|
| 518 | 518 | break; |
| 519 | 519 | } |
| 520 | 520 | |
| 521 | 521 | if ($jobId === null) { |
| 522 | - $this->logger->error('JobID cannot be null. json:' . $resultStr); |
|
| 522 | + $this->logger->error('JobID cannot be null. json:'.$resultStr); |
|
| 523 | 523 | break; |
| 524 | 524 | } |
| 525 | 525 | |
| 526 | 526 | // Step 2: Check job status |
| 527 | 527 | $jobDetails = null; |
| 528 | 528 | while (true) { |
| 529 | - $this->logger->info('Checking job ' . $jobId . ' status for module ' . $apiModuleName . ' and page ' . $page . '...'); |
|
| 530 | - $response = $client->request('GET', 'https://' . (ZOHO_CRM_SANDBOX === 'true' ? 'sandbox' : 'www') . '.zohoapis.com/crm/bulk/v2/read/' . $jobId, [ |
|
| 529 | + $this->logger->info('Checking job '.$jobId.' status for module '.$apiModuleName.' and page '.$page.'...'); |
|
| 530 | + $response = $client->request('GET', 'https://'.(ZOHO_CRM_SANDBOX === 'true' ? 'sandbox' : 'www').'.zohoapis.com/crm/bulk/v2/read/'.$jobId, [ |
|
| 531 | 531 | 'http_errors' => false, |
| 532 | 532 | 'headers' => [ |
| 533 | - 'Authorization' => 'Zoho-oauthtoken ' . $oauthToken |
|
| 533 | + 'Authorization' => 'Zoho-oauthtoken '.$oauthToken |
|
| 534 | 534 | ] |
| 535 | 535 | ]); |
| 536 | 536 | if ($response->getStatusCode() >= 200 && $response->getStatusCode() < 300) { |
@@ -548,15 +548,15 @@ discard block |
||
| 548 | 548 | $jobDetails = $json; |
| 549 | 549 | break; |
| 550 | 550 | } else { |
| 551 | - $this->logger->info('Unsupported job status: ' . $resultStr); |
|
| 551 | + $this->logger->info('Unsupported job status: '.$resultStr); |
|
| 552 | 552 | break; |
| 553 | 553 | } |
| 554 | 554 | } else { |
| 555 | - $this->logger->error('Unsupported response: ' . $resultStr); |
|
| 555 | + $this->logger->error('Unsupported response: '.$resultStr); |
|
| 556 | 556 | break; |
| 557 | 557 | } |
| 558 | 558 | } else { |
| 559 | - $this->logger->error('Cannot get bulk job status query for module ' . $apiModuleName . ': status: ' . $response->getStatusCode() . '. Status: ' . $response->getBody()->getContents()); |
|
| 559 | + $this->logger->error('Cannot get bulk job status query for module '.$apiModuleName.': status: '.$response->getStatusCode().'. Status: '.$response->getBody()->getContents()); |
|
| 560 | 560 | break; |
| 561 | 561 | } |
| 562 | 562 | sleep(15); |
@@ -564,31 +564,31 @@ discard block |
||
| 564 | 564 | |
| 565 | 565 | // Step 3: Download the result |
| 566 | 566 | if ($jobDetails === null) { |
| 567 | - $this->logger->error('JobDetails cannot be empty. json:' . $resultStr); |
|
| 567 | + $this->logger->error('JobDetails cannot be empty. json:'.$resultStr); |
|
| 568 | 568 | break; |
| 569 | 569 | } |
| 570 | 570 | $this->logger->debug(json_encode($jobDetails)); |
| 571 | - $this->logger->info('Downloading zip file for module ' . $apiModuleName . ' and page ' . $page . '...'); |
|
| 572 | - $jobZipFile = '/tmp/job_' . $dao->getZCRMModule()->getAPIName() . '_' . $jobDetails['data'][0]['id'] . '.zip'; |
|
| 571 | + $this->logger->info('Downloading zip file for module '.$apiModuleName.' and page '.$page.'...'); |
|
| 572 | + $jobZipFile = '/tmp/job_'.$dao->getZCRMModule()->getAPIName().'_'.$jobDetails['data'][0]['id'].'.zip'; |
|
| 573 | 573 | $jobCsvPath = '/tmp/job_extract'; |
| 574 | - $jobCsvFile = '/tmp/job_extract/' . $jobDetails['data'][0]['id'] . '.csv'; |
|
| 574 | + $jobCsvFile = '/tmp/job_extract/'.$jobDetails['data'][0]['id'].'.csv'; |
|
| 575 | 575 | $canProcessCsv = false; |
| 576 | 576 | |
| 577 | - $response = $client->request('GET', 'https://' . (ZOHO_CRM_SANDBOX === 'true' ? 'sandbox' : 'www') . '.zohoapis.com/crm/bulk/v2/read/' . $jobId . '/result', [ |
|
| 577 | + $response = $client->request('GET', 'https://'.(ZOHO_CRM_SANDBOX === 'true' ? 'sandbox' : 'www').'.zohoapis.com/crm/bulk/v2/read/'.$jobId.'/result', [ |
|
| 578 | 578 | 'http_errors' => false, |
| 579 | 579 | 'headers' => [ |
| 580 | - 'Authorization' => 'Zoho-oauthtoken ' . $oauthToken |
|
| 580 | + 'Authorization' => 'Zoho-oauthtoken '.$oauthToken |
|
| 581 | 581 | ], |
| 582 | 582 | 'sink' => $jobZipFile |
| 583 | 583 | ]); |
| 584 | 584 | if ($response->getStatusCode() >= 200 && $response->getStatusCode() < 300) { |
| 585 | - $this->logger->info('Extracting ' . $jobZipFile . ' file for module ' . $apiModuleName . ' and page ' . $page . '...'); |
|
| 585 | + $this->logger->info('Extracting '.$jobZipFile.' file for module '.$apiModuleName.' and page '.$page.'...'); |
|
| 586 | 586 | $zip = new ZipArchive(); |
| 587 | 587 | $res = $zip->open($jobZipFile); |
| 588 | 588 | if ($res === TRUE) { |
| 589 | 589 | $zip->extractTo($jobCsvPath); |
| 590 | 590 | $zip->close(); |
| 591 | - $this->logger->info('File extracted in ' . $jobCsvFile); |
|
| 591 | + $this->logger->info('File extracted in '.$jobCsvFile); |
|
| 592 | 592 | $canProcessCsv = true; |
| 593 | 593 | } else { |
| 594 | 594 | switch ($res) { |
@@ -620,11 +620,11 @@ discard block |
||
| 620 | 620 | $zipErrorMessage = "Unknow (Code $res)"; |
| 621 | 621 | break; |
| 622 | 622 | } |
| 623 | - $this->logger->error('Error when extracting zip file: ' . $zipErrorMessage); |
|
| 623 | + $this->logger->error('Error when extracting zip file: '.$zipErrorMessage); |
|
| 624 | 624 | break; |
| 625 | 625 | } |
| 626 | 626 | } else { |
| 627 | - $this->logger->error('Cannot download results for module ' . $apiModuleName . ': status: ' . $response->getStatusCode() . '. Status: ' . $response->getBody()->getContents()); |
|
| 627 | + $this->logger->error('Cannot download results for module '.$apiModuleName.': status: '.$response->getStatusCode().'. Status: '.$response->getBody()->getContents()); |
|
| 628 | 628 | break; |
| 629 | 629 | } |
| 630 | 630 | |
@@ -645,7 +645,7 @@ discard block |
||
| 645 | 645 | $this->logger->info('Saving records to db...'); |
| 646 | 646 | $nbRecords = $jobDetails['data'][0]['result']['count']; |
| 647 | 647 | $whenToLog = ceil($nbRecords / 100); |
| 648 | - $this->logger->info($nbRecords . ' records to save'); |
|
| 648 | + $this->logger->info($nbRecords.' records to save'); |
|
| 649 | 649 | $nbSaved = 0; |
| 650 | 650 | $handle = fopen($jobCsvFile, 'r'); |
| 651 | 651 | $fields = []; |
@@ -663,30 +663,30 @@ discard block |
||
| 663 | 663 | $recordDataToInsert[$decodedColumnName] = $value === '' ? null : $value; |
| 664 | 664 | } else { |
| 665 | 665 | if ($columnName === 'Owner' || $columnName === 'Created_By' || $columnName === 'Modified_By') { |
| 666 | - $recordDataToInsert[$decodedColumnName . '_OwnerID'] = $value === '' ? null : $value; |
|
| 667 | - $recordDataToInsert[$decodedColumnName . '_OwnerName'] = $users[$value] ?? null; |
|
| 668 | - } else if ($table->hasColumn($decodedColumnName . '_ID')) { |
|
| 669 | - $recordDataToInsert[$decodedColumnName . '_ID'] = $value === '' ? null : $value; |
|
| 666 | + $recordDataToInsert[$decodedColumnName.'_OwnerID'] = $value === '' ? null : $value; |
|
| 667 | + $recordDataToInsert[$decodedColumnName.'_OwnerName'] = $users[$value] ?? null; |
|
| 668 | + } else if ($table->hasColumn($decodedColumnName.'_ID')) { |
|
| 669 | + $recordDataToInsert[$decodedColumnName.'_ID'] = $value === '' ? null : $value; |
|
| 670 | 670 | } |
| 671 | 671 | } |
| 672 | 672 | } |
| 673 | 673 | $this->connection->insert($tableName, $recordDataToInsert); |
| 674 | 674 | ++$nbSaved; |
| 675 | 675 | if (($nbSaved % $whenToLog) === 0) { |
| 676 | - $this->logger->info($nbSaved . '/' . $nbRecords . ' records processed'); |
|
| 676 | + $this->logger->info($nbSaved.'/'.$nbRecords.' records processed'); |
|
| 677 | 677 | } |
| 678 | 678 | } |
| 679 | - $this->logger->info($nbSaved . ' records saved for module ' . $apiModuleName . ' and page ' . $page); |
|
| 679 | + $this->logger->info($nbSaved.' records saved for module '.$apiModuleName.' and page '.$page); |
|
| 680 | 680 | fclose($handle); |
| 681 | 681 | } |
| 682 | 682 | |
| 683 | 683 | // Step 5: Check if there is more results |
| 684 | 684 | $hasMoreRecords = $jobDetails['data'][0]['result']['more_records']; |
| 685 | 685 | if (!$hasMoreRecords) { |
| 686 | - $this->logger->info('No more records for the module ' . $apiModuleName); |
|
| 686 | + $this->logger->info('No more records for the module '.$apiModuleName); |
|
| 687 | 687 | break; |
| 688 | 688 | } |
| 689 | - $this->logger->info('More records to fetch for the module ' . $apiModuleName); |
|
| 689 | + $this->logger->info('More records to fetch for the module '.$apiModuleName); |
|
| 690 | 690 | ++$page; |
| 691 | 691 | } |
| 692 | 692 | } |
@@ -74,9 +74,9 @@ discard block |
||
| 74 | 74 | { |
| 75 | 75 | $tableName = ZohoDatabaseHelper::getTableName($zohoDao, $this->prefix); |
| 76 | 76 | if ($update) { |
| 77 | - return (int)$this->connection->executeQuery('SELECT COUNT(DISTINCT uid) AS nb FROM `local_update` WHERE table_name LIKE :tableName AND error IS NULL', ['tableName' => $tableName])->fetchColumn(); |
|
| 77 | + return (int) $this->connection->executeQuery('SELECT COUNT(DISTINCT uid) AS nb FROM `local_update` WHERE table_name LIKE :tableName AND error IS NULL', ['tableName' => $tableName])->fetchColumn(); |
|
| 78 | 78 | } |
| 79 | - return (int)$this->connection->executeQuery('SELECT COUNT(uid) AS nb FROM `local_insert` WHERE table_name LIKE :tableName AND error IS NULL', ['tableName' => $tableName])->fetchColumn(); |
|
| 79 | + return (int) $this->connection->executeQuery('SELECT COUNT(uid) AS nb FROM `local_insert` WHERE table_name LIKE :tableName AND error IS NULL', ['tableName' => $tableName])->fetchColumn(); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $localTable = $update ? 'local_update' : 'local_insert'; |
| 90 | 90 | $tableName = ZohoDatabaseHelper::getTableName($zohoDao, $this->prefix); |
| 91 | 91 | $countToPush = $this->countElementInTable($zohoDao, $update); |
| 92 | - $this->logger->notice($countToPush . ' records to ' . ($update ? 'update' : 'insert') . ' into Zoho for module ' . $zohoDao->getPluralModuleName()); |
|
| 92 | + $this->logger->notice($countToPush.' records to '.($update ? 'update' : 'insert').' into Zoho for module '.$zohoDao->getPluralModuleName()); |
|
| 93 | 93 | if ($countToPush) { |
| 94 | 94 | do { |
| 95 | 95 | $rowsDeleted = []; |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | ] |
| 267 | 267 | ); |
| 268 | 268 | } else { |
| 269 | - $countResult = (int)$this->connection->fetchColumn('select count(id) from ' . $tableName . ' where id = :id', ['id' => $zohoBean->getZohoId()]); |
|
| 269 | + $countResult = (int) $this->connection->fetchColumn('select count(id) from '.$tableName.' where id = :id', ['id' => $zohoBean->getZohoId()]); |
|
| 270 | 270 | //If the sent data were duplicates Zoho can merged so we need to check if the Zoho ID already exist. |
| 271 | 271 | if ($countResult === 0) { |
| 272 | 272 | // ID not exist we can update the new row with the Zoho ID |
@@ -379,13 +379,13 @@ discard block |
||
| 379 | 379 | $value = \DateTime::createFromFormat('Y-m-d H:i:s', $value) ?: null; |
| 380 | 380 | break; |
| 381 | 381 | case 'boolean' : |
| 382 | - $value = (bool)$value; |
|
| 382 | + $value = (bool) $value; |
|
| 383 | 383 | break; |
| 384 | 384 | case 'percent' : |
| 385 | - $value = (int)$value; |
|
| 385 | + $value = (int) $value; |
|
| 386 | 386 | break; |
| 387 | 387 | case 'double' : |
| 388 | - $value = (float)$value; |
|
| 388 | + $value = (float) $value; |
|
| 389 | 389 | break; |
| 390 | 390 | case 'multiselectlookup': |
| 391 | 391 | case 'multiuserlookup': |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | ] |
| 417 | 417 | ); |
| 418 | 418 | $results = $statement->execute(); |
| 419 | - $this->logger->notice($results->rowCount() . ' records to delete into Zoho for module ' . $zohoDao->getPluralModuleName()); |
|
| 419 | + $this->logger->notice($results->rowCount().' records to delete into Zoho for module '.$zohoDao->getPluralModuleName()); |
|
| 420 | 420 | while ($row = $results->fetch()) { |
| 421 | 421 | $zohoDao->delete($row['id']); |
| 422 | 422 | $this->connection->delete($localTable, ['table_name' => $tableName, 'id' => $row['id']]); |