@@ -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 | */ |
@@ -116,19 +116,19 @@ |
||
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 | } |
@@ -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', 'integer'); |
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 |
@@ -167,7 +167,6 @@ discard block |
||
167 | 167 | |
168 | 168 | /** |
169 | 169 | * Generate the User Response from Zoho |
170 | - * @param InputInterface $input |
|
171 | 170 | * @param OutputInterface $output |
172 | 171 | */ |
173 | 172 | private function getUsersReponse(OutputInterface $output) |
@@ -210,7 +209,6 @@ discard block |
||
210 | 209 | |
211 | 210 | /** |
212 | 211 | * Regerate Zoho Daos |
213 | - * @param InputInterface $input |
|
214 | 212 | * @param OutputInterface $output |
215 | 213 | */ |
216 | 214 | private function regenerateZohoDao(OutputInterface $output) |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $this->zohoDatabaseModelSync = $zohoDatabaseModelSync; |
94 | 94 | $this->zohoDatabaseCopier = $zohoDatabaseCopier; |
95 | 95 | $this->zohoDatabaseSync = $zohoDatabaseSync; |
96 | - $this->zohoEntitiesGenerator = $zohoEntitiesGenerator; |
|
96 | + $this->zohoEntitiesGenerator = $zohoEntitiesGenerator; |
|
97 | 97 | $this->zohoClient = $zohoClient; |
98 | 98 | $this->pathZohoDaos = $pathZohoDaos; |
99 | 99 | $this->namespaceZohoDaos = $namespaceZohoDaos; |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | private function getUsersReponse(OutputInterface $output) |
174 | 174 | { |
175 | 175 | $output->writeln("Start to request users data from zoho."); |
176 | - $this->usersResponse =$this->zohoClient->getUsers(); |
|
176 | + $this->usersResponse = $this->zohoClient->getUsers(); |
|
177 | 177 | $output->writeln("Finish to requuest users data from zoho."); |
178 | 178 | } |
179 | 179 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | */ |
199 | 199 | private function getListFieldName(AbstractZohoDao $zohoDao) |
200 | 200 | { |
201 | - $fieldNames= array(); |
|
201 | + $fieldNames = array(); |
|
202 | 202 | foreach ($zohoDao->getFields() as $fieldsDescriptor) { |
203 | 203 | foreach (array_values($fieldsDescriptor) as $fieldDescriptor) { |
204 | 204 | $fieldNames[] = $fieldDescriptor['name']; |
@@ -216,11 +216,11 @@ discard block |
||
216 | 216 | private function regenerateZohoDao(OutputInterface $output) |
217 | 217 | { |
218 | 218 | $output->writeln("Start to generate all the zoho daos."); |
219 | - $zohoModules = $this->zohoEntitiesGenerator->generateAll($this->pathZohoDaos,$this->namespaceZohoDaos); |
|
219 | + $zohoModules = $this->zohoEntitiesGenerator->generateAll($this->pathZohoDaos, $this->namespaceZohoDaos); |
|
220 | 220 | foreach ($zohoModules as $daoFullClassName) { |
221 | 221 | /* @var $zohoDao AbstractZohoDao */ |
222 | 222 | $zohoDao = new $daoFullClassName($this->zohoClient); |
223 | - if(!in_array('lastActivityTime', $this->getListFieldName($zohoDao))){ |
|
223 | + if (!in_array('lastActivityTime', $this->getListFieldName($zohoDao))) { |
|
224 | 224 | continue; |
225 | 225 | } |
226 | 226 | $this->zohoDaos [] = $zohoDao; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | |
82 | 82 | $flatFields = ZohoDatabaseHelper::getFlatFields($dao->getFields()); |
83 | 83 | $table->addColumn('uid', 'integer', ['autoincrement' => true]); |
84 | - $table->addColumn('id', 'string', ['length' => 100,'notnull'=>false]); |
|
84 | + $table->addColumn('id', 'string', ['length' => 100, 'notnull'=>false]); |
|
85 | 85 | $table->addUniqueIndex(['id']); |
86 | 86 | $table->setPrimaryKey(['uid']); |
87 | 87 | |
@@ -187,11 +187,11 @@ discard block |
||
187 | 187 | |
188 | 188 | $flatFields = $users->getUserFields(); |
189 | 189 | $table->addColumn('uid', 'integer', ['autoincrement' => true]); |
190 | - $table->addColumn('id', 'string', ['length' => 100,'notnull'=>false]); |
|
190 | + $table->addColumn('id', 'string', ['length' => 100, 'notnull'=>false]); |
|
191 | 191 | $table->addUniqueIndex(['id']); |
192 | 192 | $table->setPrimaryKey(['uid']); |
193 | 193 | foreach ($flatFields as $field) { |
194 | - if(in_array($field, ['id'])){ |
|
194 | + if (in_array($field, ['id'])) { |
|
195 | 195 | continue; |
196 | 196 | } |
197 | 197 | $columnName = $field; |