@@ -16,6 +16,7 @@ |
||
16 | 16 | * Computes the name of the table based on the DAO plural module name. |
17 | 17 | * |
18 | 18 | * @param AbstractZohoDao $dao |
19 | + * @param string $prefix |
|
19 | 20 | * |
20 | 21 | * @return string |
21 | 22 | */ |
@@ -6,7 +6,6 @@ |
||
6 | 6 | use Psr\Log\LoggerInterface; |
7 | 7 | use Psr\Log\NullLogger; |
8 | 8 | use Wabel\Zoho\CRM\AbstractZohoDao; |
9 | -use Wabel\Zoho\CRM\Request\Response; |
|
10 | 9 | |
11 | 10 | /** |
12 | 11 | * This class is in charge of synchronizing one table of your database with Zoho records. |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | $object = $user->{$fieldMethod}(); |
103 | 103 | $data[$column->getName()] = $object->getName(); |
104 | 104 | } |
105 | - elseif($column->getName() === 'Currency') { |
|
105 | + elseif ($column->getName() === 'Currency') { |
|
106 | 106 | //Todo: Do a pull request about \ZCRMUser::geCurrency() to \ZCRMUser::getCurrency() |
107 | 107 | $data[$column->getName()] = $user->geCurrency(); |
108 | 108 | } |
@@ -114,14 +114,14 @@ discard block |
||
114 | 114 | $select->execute(['id' => $user->getId()]); |
115 | 115 | $result = $select->fetch(\PDO::FETCH_ASSOC); |
116 | 116 | if ($result === false && $data) { |
117 | - $this->logger->debug("Inserting record with ID '" . $user->getId() . "'."); |
|
117 | + $this->logger->debug("Inserting record with ID '".$user->getId()."'."); |
|
118 | 118 | |
119 | 119 | $data['id'] = $user->getId(); |
120 | 120 | $types['id'] = 'string'; |
121 | 121 | |
122 | 122 | $this->connection->insert($tableName, $data, $types); |
123 | - } elseif($data) { |
|
124 | - $this->logger->debug("Updating record with ID '" . $user->getId() . "'."); |
|
123 | + } elseif ($data) { |
|
124 | + $this->logger->debug("Updating record with ID '".$user->getId()."'."); |
|
125 | 125 | $identifier = ['id' => $user->getId()]; |
126 | 126 | $types['id'] = 'string'; |
127 | 127 | $this->connection->update($tableName, $data, $identifier, $types); |
@@ -149,10 +149,10 @@ discard block |
||
149 | 149 | // Let's get the last modification date: |
150 | 150 | $tableDetail = $this->connection->getSchemaManager()->listTableDetails($tableName); |
151 | 151 | $lastActivityTime = null; |
152 | - if($tableDetail->hasColumn('modifiedTime')) { |
|
152 | + if ($tableDetail->hasColumn('modifiedTime')) { |
|
153 | 153 | $lastActivityTime = $this->connection->fetchColumn('SELECT MAX(modifiedTime) FROM '.$tableName); |
154 | 154 | } |
155 | - if(!$lastActivityTime && $tableDetail->hasColumn('createdTime')) { |
|
155 | + if (!$lastActivityTime && $tableDetail->hasColumn('createdTime')) { |
|
156 | 156 | $lastActivityTime = $this->connection->fetchColumn('SELECT MAX(createdTime) FROM '.$tableName); |
157 | 157 | } |
158 | 158 | |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | continue; |
190 | 190 | } else { |
191 | 191 | $field = $dao->getFieldFromFieldName($column->getName()); |
192 | - if(!$field) { |
|
192 | + if (!$field) { |
|
193 | 193 | continue; |
194 | 194 | } |
195 | 195 | $getterName = $field->getGetter(); |
@@ -95,18 +95,15 @@ |
||
95 | 95 | && array_key_exists('id', $user->{$fieldMethod}()) |
96 | 96 | ) { |
97 | 97 | $data[$column->getName()] = $user->{$fieldMethod}()['name']; |
98 | - } |
|
99 | - elseif (method_exists($user, $fieldMethod) |
|
98 | + } elseif (method_exists($user, $fieldMethod) |
|
100 | 99 | && is_object($user->{$fieldMethod}()) && method_exists($user->{$fieldMethod}(), 'getName') |
101 | 100 | ) { |
102 | 101 | $object = $user->{$fieldMethod}(); |
103 | 102 | $data[$column->getName()] = $object->getName(); |
104 | - } |
|
105 | - elseif($column->getName() === 'Currency') { |
|
103 | + } elseif($column->getName() === 'Currency') { |
|
106 | 104 | //Todo: Do a pull request about \ZCRMUser::geCurrency() to \ZCRMUser::getCurrency() |
107 | 105 | $data[$column->getName()] = $user->geCurrency(); |
108 | - } |
|
109 | - else { |
|
106 | + } else { |
|
110 | 107 | continue; |
111 | 108 | } |
112 | 109 | } |
@@ -49,7 +49,7 @@ |
||
49 | 49 | $localDelete = $schema->createTable('local_delete'); |
50 | 50 | $localDelete->addColumn('table_name', 'string', ['length' => 100]); |
51 | 51 | $localDelete->addColumn('uid', 'string', ['length' => 36]); |
52 | - $localDelete->addColumn('id', 'string', ['length' => 100,'notnull'=>false]); |
|
52 | + $localDelete->addColumn('id', 'string', ['length' => 100, 'notnull'=>false]); |
|
53 | 53 | $localDelete->setPrimaryKey(array('table_name', 'uid')); |
54 | 54 | $localDelete->addUniqueIndex(['id', 'table_name']); |
55 | 55 |
@@ -202,7 +202,6 @@ |
||
202 | 202 | * Insert data to bean in order to update zoho records. |
203 | 203 | * |
204 | 204 | * @param ZohoBeanInterface $zohoBean |
205 | - * @param array $fieldsMatching |
|
206 | 205 | * @param type $columnName |
207 | 206 | * @param type $valueDb |
208 | 207 | */ |
@@ -230,26 +230,26 @@ |
||
230 | 230 | private function formatValueToBeans($type, $value) |
231 | 231 | { |
232 | 232 | switch ($type) { |
233 | - case 'date': |
|
234 | - $value = \DateTime::createFromFormat('Y-m-d', $value)?:null; |
|
235 | - break; |
|
236 | - case 'datetime': |
|
237 | - $value = \DateTime::createFromFormat('Y-m-d H:i:s', $value)?:null; |
|
238 | - break; |
|
239 | - case 'boolean' : |
|
240 | - $value = (bool) $value; |
|
241 | - break; |
|
242 | - case 'percent' : |
|
243 | - $value = (int) $value; |
|
244 | - break; |
|
245 | - case 'double' : |
|
246 | - $value = number_format($value, 2); |
|
247 | - break; |
|
248 | - case 'multiselectlookup': |
|
249 | - case 'multiuserlookup': |
|
250 | - case 'multiselectpicklist': |
|
251 | - $value = explode(';', $value); |
|
252 | - break; |
|
233 | + case 'date': |
|
234 | + $value = \DateTime::createFromFormat('Y-m-d', $value)?:null; |
|
235 | + break; |
|
236 | + case 'datetime': |
|
237 | + $value = \DateTime::createFromFormat('Y-m-d H:i:s', $value)?:null; |
|
238 | + break; |
|
239 | + case 'boolean' : |
|
240 | + $value = (bool) $value; |
|
241 | + break; |
|
242 | + case 'percent' : |
|
243 | + $value = (int) $value; |
|
244 | + break; |
|
245 | + case 'double' : |
|
246 | + $value = number_format($value, 2); |
|
247 | + break; |
|
248 | + case 'multiselectlookup': |
|
249 | + case 'multiuserlookup': |
|
250 | + case 'multiselectpicklist': |
|
251 | + $value = explode(';', $value); |
|
252 | + break; |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | return $value; |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $this->logger = $logger; |
48 | 48 | } |
49 | 49 | $this->apiLimitInsertUpdateDelete = $apiLimitInsertUpdateDelete; |
50 | - if($apiLimitInsertUpdateDelete === null) { |
|
50 | + if ($apiLimitInsertUpdateDelete === null) { |
|
51 | 51 | $this->apiLimitInsertUpdateDelete = 100; |
52 | 52 | } |
53 | 53 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | { |
82 | 82 | $localTable = $update ? 'local_update' : 'local_insert'; |
83 | 83 | $tableName = ZohoDatabaseHelper::getTableName($zohoDao, $this->prefix); |
84 | - do{ |
|
84 | + do { |
|
85 | 85 | $rowsDeleted = []; |
86 | 86 | //@see https://www.zoho.com/crm/help/api/v2/#ra-update-records |
87 | 87 | //To optimize your API usage, get maximum 200 records with each request and insert, update or delete maximum 100 records with each request. |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | $rowsDeleted[] = $row['uid']; |
129 | 129 | } |
130 | 130 | } |
131 | - if($zohoBeans) { |
|
131 | + if ($zohoBeans) { |
|
132 | 132 | $this->sendDataToZohoCleanLocal($zohoDao, $zohoBeans, $rowsDeleted, $update); |
133 | 133 | } |
134 | 134 | $countToPush = $this->countElementInTable($zohoDao, $update); |
135 | - } while($countToPush > 0); |
|
135 | + } while ($countToPush > 0); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * @param string[] $rowsDeleted |
142 | 142 | * @param bool $update |
143 | 143 | */ |
144 | - private function sendDataToZohoCleanLocal(AbstractZohoDao $zohoDao, array $zohoBeans,$rowsDeleted, $update = false) |
|
144 | + private function sendDataToZohoCleanLocal(AbstractZohoDao $zohoDao, array $zohoBeans, $rowsDeleted, $update = false) |
|
145 | 145 | { |
146 | 146 | $tableName = ZohoDatabaseHelper::getTableName($zohoDao, $this->prefix); |
147 | 147 | $zohoDao->save($zohoBeans); |
@@ -153,13 +153,13 @@ discard block |
||
153 | 153 | // ID not exist we can update the new row with the Zoho ID |
154 | 154 | $this->connection->beginTransaction(); |
155 | 155 | $this->connection->update($tableName, ['id' => $zohoBean->getZohoId()], ['uid' => $uid]); |
156 | - $this->connection->delete('local_insert', ['table_name'=>$tableName, 'uid' => $uid ]); |
|
156 | + $this->connection->delete('local_insert', ['table_name'=>$tableName, 'uid' => $uid]); |
|
157 | 157 | $this->connection->commit(); |
158 | 158 | } else { |
159 | 159 | //ID already exist we need to delete the duplicate row. |
160 | 160 | $this->connection->beginTransaction(); |
161 | - $this->connection->delete($tableName, ['uid' => $uid ]); |
|
162 | - $this->connection->delete('local_insert', ['table_name'=>$tableName, 'uid' => $uid ]); |
|
161 | + $this->connection->delete($tableName, ['uid' => $uid]); |
|
162 | + $this->connection->delete('local_insert', ['table_name'=>$tableName, 'uid' => $uid]); |
|
163 | 163 | $this->connection->commit(); |
164 | 164 | } |
165 | 165 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | { |
188 | 188 | foreach ($row as $columnName => $columnValue) { |
189 | 189 | $fieldMethod = $dao->getFieldFromFieldName($columnName); |
190 | - if(!in_array($columnName, EntitiesGeneratorService::$defaultDateFields) && $fieldMethod |
|
190 | + if (!in_array($columnName, EntitiesGeneratorService::$defaultDateFields) && $fieldMethod |
|
191 | 191 | && (!in_array($columnName, ['id', 'uid'])) && !is_null($columnValue) |
192 | 192 | ) { |
193 | 193 | $type = $fieldMethod->getType(); |
@@ -231,10 +231,10 @@ discard block |
||
231 | 231 | { |
232 | 232 | switch ($type) { |
233 | 233 | case 'date': |
234 | - $value = \DateTime::createFromFormat('Y-m-d', $value)?:null; |
|
234 | + $value = \DateTime::createFromFormat('Y-m-d', $value) ?: null; |
|
235 | 235 | break; |
236 | 236 | case 'datetime': |
237 | - $value = \DateTime::createFromFormat('Y-m-d H:i:s', $value)?:null; |
|
237 | + $value = \DateTime::createFromFormat('Y-m-d H:i:s', $value) ?: null; |
|
238 | 238 | break; |
239 | 239 | case 'boolean' : |
240 | 240 | $value = (bool) $value; |
@@ -190,7 +190,6 @@ |
||
190 | 190 | /** |
191 | 191 | * Regerate Zoho Daos |
192 | 192 | * |
193 | - * @param InputInterface $input |
|
194 | 193 | * @param OutputInterface $output |
195 | 194 | */ |
196 | 195 | private function regenerateZohoDao(OutputInterface $output) |
@@ -15,7 +15,6 @@ |
||
15 | 15 | use Logger\Formatters\DateTimeFormatter; |
16 | 16 | use Mouf\Utils\Log\Psr\MultiLogger; |
17 | 17 | use Wabel\Zoho\CRM\Request\Response; |
18 | -use zcrmsdk\crm\utility\ZCRMConfigUtil; |
|
19 | 18 | |
20 | 19 | class ZohoSyncDatabaseCommand extends Command |
21 | 20 | { |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $this->zohoDatabaseModelSync = $zohoDatabaseModelSync; |
102 | 102 | $this->zohoDatabaseCopier = $zohoDatabaseCopier; |
103 | 103 | $this->zohoDatabaseSync = $zohoDatabaseSync; |
104 | - $this->zohoEntitiesGenerator = $zohoEntitiesGenerator; |
|
104 | + $this->zohoEntitiesGenerator = $zohoEntitiesGenerator; |
|
105 | 105 | $this->zohoClient = $zohoClient; |
106 | 106 | $this->pathZohoDaos = $pathZohoDaos; |
107 | 107 | $this->namespaceZohoDaos = $namespaceZohoDaos; |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | if ($input->getOption('log-path') && $input->getOption('clear-logs')) { |
138 | 138 | $output->writeln('Clearing logs...'); |
139 | 139 | $path = $input->getOption('log-path'); |
140 | - $logFile = $path . '/ZCRMClientLibrary.log'; |
|
140 | + $logFile = $path.'/ZCRMClientLibrary.log'; |
|
141 | 141 | if (file_exists($logFile)) { |
142 | 142 | if (is_writable($logFile)) { |
143 | 143 | if (file_put_contents($logFile, '') === false) { |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
154 | - if(!$input->getOption('limit')) { |
|
154 | + if (!$input->getOption('limit')) { |
|
155 | 155 | ini_set('memory_limit', '-1'); |
156 | 156 | } |
157 | 157 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | if ($input->getOption('log-path') && $input->getOption('dump-logs')) { |
177 | 177 | $output->writeln('Dumping logs...'); |
178 | 178 | $path = $input->getOption('log-path'); |
179 | - $logFile = $path . '/ZCRMClientLibrary.log'; |
|
179 | + $logFile = $path.'/ZCRMClientLibrary.log'; |
|
180 | 180 | if (file_exists($logFile)) { |
181 | 181 | if (is_readable($logFile)) { |
182 | 182 | $output->writeln(file_get_contents($logFile)); |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | { |
297 | 297 | $output->writeln('Start to synchronize Zoho data into Zoho CRM.'); |
298 | 298 | foreach ($this->zohoDaos as $zohoDao) { |
299 | - if($zohoDao->getFieldFromFieldName('createdTime')) { |
|
299 | + if ($zohoDao->getFieldFromFieldName('createdTime')) { |
|
300 | 300 | $this->zohoDatabaseSync->pushToZoho($zohoDao); |
301 | 301 | } |
302 | 302 | } |
@@ -102,80 +102,80 @@ discard block |
||
102 | 102 | $options = []; |
103 | 103 | // Note: full list of types available here: https://www.zoho.com/crm/help/customization/custom-fields.html |
104 | 104 | switch ($field->getType()) { |
105 | - case 'fileupload': |
|
106 | - $type = 'string'; |
|
107 | - $length = $field->getMaxlength() && $field->getMaxlength() > 0?$field->getMaxlength() : 255; |
|
108 | - break; |
|
109 | - case 'lookup': |
|
110 | - $type = 'string'; |
|
111 | - $length = $field->getMaxlength() && $field->getMaxlength() > 0?$field->getMaxlength() : 100; |
|
112 | - $index = true; |
|
113 | - break; |
|
114 | - case 'userlookup': |
|
115 | - case 'ownerlookup': |
|
116 | - $type = 'string'; |
|
117 | - $index = true; |
|
118 | - $length = $field->getMaxlength() && $field->getMaxlength() > 0?$field->getMaxlength() : 25; |
|
119 | - break; |
|
120 | - case 'formula': |
|
121 | - // Note: a Formula can return any type, but we have no way to know which type it returns... |
|
122 | - $type = 'string'; |
|
123 | - $length = $field->getMaxlength() && $field->getMaxlength() > 0?$field->getMaxlength() : 100; |
|
124 | - break; |
|
125 | - case 'datetime': |
|
126 | - $type = 'datetime'; |
|
127 | - break; |
|
128 | - case 'date': |
|
129 | - $type = 'date'; |
|
130 | - break; |
|
131 | - case 'boolean': |
|
132 | - $type = 'boolean'; |
|
133 | - break; |
|
134 | - case 'textarea': |
|
135 | - $type = 'text'; |
|
136 | - break; |
|
137 | - case 'bigint': |
|
138 | - $type = 'bigint'; |
|
139 | - break; |
|
140 | - case 'phone': |
|
141 | - case 'text': |
|
142 | - case 'url': |
|
143 | - case 'email': |
|
144 | - case 'picklist': |
|
145 | - case 'website': |
|
146 | - $type = 'string'; |
|
147 | - $length = $field->getMaxlength() && $field->getMaxlength() > 0?$field->getMaxlength() : 255; |
|
148 | - break; |
|
149 | - case 'multiselectlookup': |
|
150 | - case 'multiuserlookup': |
|
151 | - case 'multiselectpicklist': |
|
152 | - $type = 'text'; |
|
153 | - break; |
|
154 | - case 'percent': |
|
155 | - $type = 'integer'; |
|
156 | - break; |
|
157 | - case 'double': |
|
158 | - $type = 'float'; |
|
159 | - break; |
|
160 | - case 'autonumber': |
|
161 | - case 'integer': |
|
162 | - $type = 'integer'; |
|
163 | - $length = $field->getMaxlength() && $field->getMaxlength() > 0?$field->getMaxlength() : 255; |
|
164 | - break; |
|
165 | - case 'currency': |
|
166 | - case 'decimal': |
|
167 | - $type = 'decimal'; |
|
168 | - $options['scale'] = 2; |
|
169 | - break; |
|
170 | - case 'consent_lookup': |
|
171 | - case 'profileimage': |
|
172 | - case 'ALARM': |
|
173 | - case 'RRULE': |
|
174 | - case 'event_reminder': |
|
175 | - continue 2; |
|
105 | + case 'fileupload': |
|
106 | + $type = 'string'; |
|
107 | + $length = $field->getMaxlength() && $field->getMaxlength() > 0?$field->getMaxlength() : 255; |
|
176 | 108 | break; |
177 | - default: |
|
178 | - throw new \RuntimeException('Unknown type "'.$field->getType().'"'); |
|
109 | + case 'lookup': |
|
110 | + $type = 'string'; |
|
111 | + $length = $field->getMaxlength() && $field->getMaxlength() > 0?$field->getMaxlength() : 100; |
|
112 | + $index = true; |
|
113 | + break; |
|
114 | + case 'userlookup': |
|
115 | + case 'ownerlookup': |
|
116 | + $type = 'string'; |
|
117 | + $index = true; |
|
118 | + $length = $field->getMaxlength() && $field->getMaxlength() > 0?$field->getMaxlength() : 25; |
|
119 | + break; |
|
120 | + case 'formula': |
|
121 | + // Note: a Formula can return any type, but we have no way to know which type it returns... |
|
122 | + $type = 'string'; |
|
123 | + $length = $field->getMaxlength() && $field->getMaxlength() > 0?$field->getMaxlength() : 100; |
|
124 | + break; |
|
125 | + case 'datetime': |
|
126 | + $type = 'datetime'; |
|
127 | + break; |
|
128 | + case 'date': |
|
129 | + $type = 'date'; |
|
130 | + break; |
|
131 | + case 'boolean': |
|
132 | + $type = 'boolean'; |
|
133 | + break; |
|
134 | + case 'textarea': |
|
135 | + $type = 'text'; |
|
136 | + break; |
|
137 | + case 'bigint': |
|
138 | + $type = 'bigint'; |
|
139 | + break; |
|
140 | + case 'phone': |
|
141 | + case 'text': |
|
142 | + case 'url': |
|
143 | + case 'email': |
|
144 | + case 'picklist': |
|
145 | + case 'website': |
|
146 | + $type = 'string'; |
|
147 | + $length = $field->getMaxlength() && $field->getMaxlength() > 0?$field->getMaxlength() : 255; |
|
148 | + break; |
|
149 | + case 'multiselectlookup': |
|
150 | + case 'multiuserlookup': |
|
151 | + case 'multiselectpicklist': |
|
152 | + $type = 'text'; |
|
153 | + break; |
|
154 | + case 'percent': |
|
155 | + $type = 'integer'; |
|
156 | + break; |
|
157 | + case 'double': |
|
158 | + $type = 'float'; |
|
159 | + break; |
|
160 | + case 'autonumber': |
|
161 | + case 'integer': |
|
162 | + $type = 'integer'; |
|
163 | + $length = $field->getMaxlength() && $field->getMaxlength() > 0?$field->getMaxlength() : 255; |
|
164 | + break; |
|
165 | + case 'currency': |
|
166 | + case 'decimal': |
|
167 | + $type = 'decimal'; |
|
168 | + $options['scale'] = 2; |
|
169 | + break; |
|
170 | + case 'consent_lookup': |
|
171 | + case 'profileimage': |
|
172 | + case 'ALARM': |
|
173 | + case 'RRULE': |
|
174 | + case 'event_reminder': |
|
175 | + continue 2; |
|
176 | + break; |
|
177 | + default: |
|
178 | + throw new \RuntimeException('Unknown type "'.$field->getType().'"'); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | |
@@ -222,24 +222,24 @@ discard block |
||
222 | 222 | $length = null; |
223 | 223 | $index = false; |
224 | 224 | switch ($field) { |
225 | - case 'zuid': |
|
226 | - $type = 'string'; |
|
227 | - $length = 100; |
|
228 | - $index = true; |
|
229 | - break; |
|
230 | - case 'name': |
|
231 | - case 'email': |
|
232 | - $type = 'string'; |
|
233 | - $length = 255; |
|
234 | - $index = true; |
|
235 | - break; |
|
236 | - case 'phone': |
|
237 | - case 'website': |
|
238 | - $type = 'text'; |
|
239 | - break; |
|
240 | - default: |
|
241 | - $type = 'string'; |
|
242 | - $length = 100; |
|
225 | + case 'zuid': |
|
226 | + $type = 'string'; |
|
227 | + $length = 100; |
|
228 | + $index = true; |
|
229 | + break; |
|
230 | + case 'name': |
|
231 | + case 'email': |
|
232 | + $type = 'string'; |
|
233 | + $length = 255; |
|
234 | + $index = true; |
|
235 | + break; |
|
236 | + case 'phone': |
|
237 | + case 'website': |
|
238 | + $type = 'text'; |
|
239 | + break; |
|
240 | + default: |
|
241 | + $type = 'string'; |
|
242 | + $length = 100; |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | $options = []; |
@@ -7,7 +7,6 @@ |
||
7 | 7 | use Psr\Log\LoggerInterface; |
8 | 8 | use Psr\Log\NullLogger; |
9 | 9 | use Wabel\Zoho\CRM\AbstractZohoDao; |
10 | -use Wabel\Zoho\CRM\Request\Response; |
|
11 | 10 | use zcrmsdk\crm\setup\users\ZCRMUser; |
12 | 11 | |
13 | 12 | /** |
@@ -86,15 +86,15 @@ discard block |
||
86 | 86 | $table = $schema->createTable($tableName); |
87 | 87 | |
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 ($dao->getFields() as $field) { |
95 | 95 | $columnName = $field->getName(); |
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 | |
@@ -105,23 +105,23 @@ discard block |
||
105 | 105 | switch ($field->getType()) { |
106 | 106 | case 'fileupload': |
107 | 107 | $type = 'string'; |
108 | - $length = $field->getMaxlength() && $field->getMaxlength() > 0?$field->getMaxlength() : 255; |
|
108 | + $length = $field->getMaxlength() && $field->getMaxlength() > 0 ? $field->getMaxlength() : 255; |
|
109 | 109 | break; |
110 | 110 | case 'lookup': |
111 | 111 | $type = 'string'; |
112 | - $length = $field->getMaxlength() && $field->getMaxlength() > 0?$field->getMaxlength() : 100; |
|
112 | + $length = $field->getMaxlength() && $field->getMaxlength() > 0 ? $field->getMaxlength() : 100; |
|
113 | 113 | $index = true; |
114 | 114 | break; |
115 | 115 | case 'userlookup': |
116 | 116 | case 'ownerlookup': |
117 | 117 | $type = 'string'; |
118 | 118 | $index = true; |
119 | - $length = $field->getMaxlength() && $field->getMaxlength() > 0?$field->getMaxlength() : 25; |
|
119 | + $length = $field->getMaxlength() && $field->getMaxlength() > 0 ? $field->getMaxlength() : 25; |
|
120 | 120 | break; |
121 | 121 | case 'formula': |
122 | 122 | // Note: a Formula can return any type, but we have no way to know which type it returns... |
123 | 123 | $type = 'string'; |
124 | - $length = $field->getMaxlength() && $field->getMaxlength() > 0?$field->getMaxlength() : 100; |
|
124 | + $length = $field->getMaxlength() && $field->getMaxlength() > 0 ? $field->getMaxlength() : 100; |
|
125 | 125 | break; |
126 | 126 | case 'datetime': |
127 | 127 | $type = 'datetime'; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | case 'picklist': |
146 | 146 | case 'website': |
147 | 147 | $type = 'string'; |
148 | - $length = $field->getMaxlength() && $field->getMaxlength() > 0?$field->getMaxlength() : 255; |
|
148 | + $length = $field->getMaxlength() && $field->getMaxlength() > 0 ? $field->getMaxlength() : 255; |
|
149 | 149 | break; |
150 | 150 | case 'multiselectlookup': |
151 | 151 | case 'multiuserlookup': |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | case 'autonumber': |
162 | 162 | case 'integer': |
163 | 163 | $type = 'integer'; |
164 | - $length = $field->getMaxlength() && $field->getMaxlength() > 0?$field->getMaxlength() : 255; |
|
164 | + $length = $field->getMaxlength() && $field->getMaxlength() > 0 ? $field->getMaxlength() : 255; |
|
165 | 165 | break; |
166 | 166 | case 'currency': |
167 | 167 | case 'decimal': |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | $schema = new Schema(); |
214 | 214 | $table = $schema->createTable($tableName); |
215 | 215 | |
216 | - $table->addColumn('id', 'string', ['length' => 100,'notnull'=>false]); |
|
216 | + $table->addColumn('id', 'string', ['length' => 100, 'notnull'=>false]); |
|
217 | 217 | $table->setPrimaryKey(['id']); |
218 | 218 | foreach (ZCRMUser::$defaultKeys as $field) { |
219 | 219 | if ($field === 'id') { |
@@ -3,7 +3,6 @@ |
||
3 | 3 | |
4 | 4 | use Doctrine\DBAL\Connection; |
5 | 5 | use Doctrine\DBAL\Logging\SQLLogger; |
6 | -use Doctrine\DBAL\SQLParserUtils; |
|
7 | 6 | use function PHPSTORM_META\type; |
8 | 7 | use Psr\Log\LoggerInterface; |
9 | 8 |
@@ -57,7 +57,7 @@ |
||
57 | 57 | $query = null; |
58 | 58 | if ($params && $this->authorizedSQLWithParams) { |
59 | 59 | $this->logger->debug($sql.' -- Params : {params} - Types : {types}', ['params' => json_encode($params), 'types' => json_encode($types)]); |
60 | - } elseif($this->authorizedSQLWithoutParams) { |
|
60 | + } elseif ($this->authorizedSQLWithoutParams) { |
|
61 | 61 | $this->logger->debug($sql); |
62 | 62 | } |
63 | 63 | } |