![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/mautic.corals.io/plugins/MauticCrmBundle/Integration/Salesforce/ |
<?php namespace MauticPlugin\MauticCrmBundle\Integration\Salesforce; use MauticPlugin\MauticCrmBundle\Integration\Salesforce\Exception\NoObjectsToFetchException; class QueryBuilder { /** * @throws NoObjectsToFetchException */ public static function getLeadQuery(array $fields, array $ids): string { if (empty($ids)) { throw new NoObjectsToFetchException(); } $fieldString = self::getFieldString($fields); $idString = implode("','", $ids); return ($idString) ? "SELECT $fieldString from Lead where Id in ('$idString') and ConvertedContactId = NULL" : ''; } /** * @throws NoObjectsToFetchException */ public static function getContactQuery(array $fields, array $ids): string { if (empty($ids)) { throw new NoObjectsToFetchException(); } $fieldString = self::getFieldString($fields); $idString = implode("','", $ids); return ($idString) ? "SELECT $fieldString from Contact where Id in ('$idString')" : ''; } private static function getFieldString(array $fields): string { $fields[] = 'Id'; return implode(', ', array_unique($fields)); } }