@@ -136,6 +136,7 @@ |
||
| 136 | 136 | * |
| 137 | 137 | * Fetch all records from the target table, where the PID equals the PID specified in the target section of the strategy |
| 138 | 138 | * |
| 139 | + * @param string $selectFields |
|
| 139 | 140 | * @return void |
| 140 | 141 | */ |
| 141 | 142 | public function getRecords($selectFields) |
@@ -2,8 +2,6 @@ |
||
| 2 | 2 | namespace HDNET\Importr\Service\Targets; |
| 3 | 3 | |
| 4 | 4 | use HDNET\Importr\Domain\Model\Strategy; |
| 5 | -use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; |
|
| 6 | -use HDNET\Importr\Utility; |
|
| 7 | 5 | |
| 8 | 6 | /** |
| 9 | 7 | * Imports records from a .CSV file into the target table which you can specify on the target section in your strategy. |
@@ -5,49 +5,49 @@ discard block |
||
| 5 | 5 | use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; |
| 6 | 6 | use HDNET\Importr\Utility; |
| 7 | 7 | |
| 8 | - /** |
|
| 9 | - * Imports records from a .CSV file into the target table which you |
|
| 10 | - * can specify on the target section in your strategy. |
|
| 11 | - * If a record does not exist in the table, it will be inserted, |
|
| 12 | - * otherwise it will be just updated. No duplicates are created. |
|
| 13 | - * |
|
| 14 | - * complete example (strategy target): |
|
| 15 | - * |
|
| 16 | - * HDNET\Importr\Service\Targets\InsertUpdateTable: |
|
| 17 | - * model: TYPO3\CMS\Extbase\Domain\Model\FrontendUser |
|
| 18 | - * repository: TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository |
|
| 19 | - * target_table: fe_users |
|
| 20 | - * exclude_from_update: |
|
| 21 | - * 0: password |
|
| 22 | - * 1: first_name |
|
| 23 | - * 2: zip |
|
| 24 | - * pid: 324 |
|
| 25 | - * mapping: |
|
| 26 | - * 0: username |
|
| 27 | - * 1: password |
|
| 28 | - * 2: usergroup |
|
| 29 | - * 3: name |
|
| 30 | - * 4: first_name |
|
| 31 | - * 5: address |
|
| 32 | - * 6: telephone |
|
| 33 | - * 7: email |
|
| 34 | - * 8: zip |
|
| 35 | - * 9: city |
|
| 36 | - * 10: company |
|
| 37 | - * |
|
| 38 | - * Example CSV: |
|
| 39 | - * |
|
| 40 | - * username;password;usergroup;name;first_name;address;telephone;email;zip;city;company |
|
| 41 | - * EduardFekete;PW123;3;Fekete;Eduard; Example 21; +049123456789;[email protected];91550;Feuchtwangen;MB Connect Line GmbH |
|
| 42 | - * HansVader;PW1234;3;Vader;Hans; Example 22; +049123456710;[email protected];99900;Universe;Hollywood Studios |
|
| 43 | - * |
|
| 44 | - * ------------------------------------------------------------------------------------------------ |
|
| 45 | - * |
|
| 46 | - * exclude_from_update: the elements specified in this array, are never being updated |
|
| 47 | - * |
|
| 48 | - * ------------------------------------------------------------------------------------------------ |
|
| 49 | - * @author Eduard Fekete |
|
| 50 | - */ |
|
| 8 | + /** |
|
| 9 | + * Imports records from a .CSV file into the target table which you |
|
| 10 | + * can specify on the target section in your strategy. |
|
| 11 | + * If a record does not exist in the table, it will be inserted, |
|
| 12 | + * otherwise it will be just updated. No duplicates are created. |
|
| 13 | + * |
|
| 14 | + * complete example (strategy target): |
|
| 15 | + * |
|
| 16 | + * HDNET\Importr\Service\Targets\InsertUpdateTable: |
|
| 17 | + * model: TYPO3\CMS\Extbase\Domain\Model\FrontendUser |
|
| 18 | + * repository: TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository |
|
| 19 | + * target_table: fe_users |
|
| 20 | + * exclude_from_update: |
|
| 21 | + * 0: password |
|
| 22 | + * 1: first_name |
|
| 23 | + * 2: zip |
|
| 24 | + * pid: 324 |
|
| 25 | + * mapping: |
|
| 26 | + * 0: username |
|
| 27 | + * 1: password |
|
| 28 | + * 2: usergroup |
|
| 29 | + * 3: name |
|
| 30 | + * 4: first_name |
|
| 31 | + * 5: address |
|
| 32 | + * 6: telephone |
|
| 33 | + * 7: email |
|
| 34 | + * 8: zip |
|
| 35 | + * 9: city |
|
| 36 | + * 10: company |
|
| 37 | + * |
|
| 38 | + * Example CSV: |
|
| 39 | + * |
|
| 40 | + * username;password;usergroup;name;first_name;address;telephone;email;zip;city;company |
|
| 41 | + * EduardFekete;PW123;3;Fekete;Eduard; Example 21; +049123456789;[email protected];91550;Feuchtwangen;MB Connect Line GmbH |
|
| 42 | + * HansVader;PW1234;3;Vader;Hans; Example 22; +049123456710;[email protected];99900;Universe;Hollywood Studios |
|
| 43 | + * |
|
| 44 | + * ------------------------------------------------------------------------------------------------ |
|
| 45 | + * |
|
| 46 | + * exclude_from_update: the elements specified in this array, are never being updated |
|
| 47 | + * |
|
| 48 | + * ------------------------------------------------------------------------------------------------ |
|
| 49 | + * @author Eduard Fekete |
|
| 50 | + */ |
|
| 51 | 51 | |
| 52 | 52 | class InsertUpdateTable extends AbstractTarget implements TargetInterface |
| 53 | 53 | { |
@@ -178,14 +178,14 @@ discard block |
||
| 178 | 178 | $GLOBALS['TYPO3_DB']->sql_insert_id(); |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - /** |
|
| 182 | - * Update a record in the target table which you have specified in the |
|
| 183 | - * target section of the strategy (don't update the password) |
|
| 184 | - * |
|
| 185 | - * @param array $entry |
|
| 186 | - * |
|
| 187 | - * @return void |
|
| 188 | - */ |
|
| 181 | + /** |
|
| 182 | + * Update a record in the target table which you have specified in the |
|
| 183 | + * target section of the strategy (don't update the password) |
|
| 184 | + * |
|
| 185 | + * @param array $entry |
|
| 186 | + * |
|
| 187 | + * @return void |
|
| 188 | + */ |
|
| 189 | 189 | public function updateRecord(array $entry) |
| 190 | 190 | { |
| 191 | 191 | $into_table = $this->configuration['target_table']; |
@@ -206,14 +206,14 @@ discard block |
||
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | /** |
| 209 | - * This function creates a duplicate of a associative array and optionally removes |
|
| 210 | - * any entries which are also elements of a second array |
|
| 211 | - * |
|
| 212 | - * @param array $arr |
|
| 213 | - * @param array $exclude_arr |
|
| 214 | - * |
|
| 215 | - * @return array |
|
| 216 | - */ |
|
| 209 | + * This function creates a duplicate of a associative array and optionally removes |
|
| 210 | + * any entries which are also elements of a second array |
|
| 211 | + * |
|
| 212 | + * @param array $arr |
|
| 213 | + * @param array $exclude_arr |
|
| 214 | + * |
|
| 215 | + * @return array |
|
| 216 | + */ |
|
| 217 | 217 | public function duplicateArray(array $arr, array $exclude_arr = null) |
| 218 | 218 | { |
| 219 | 219 | $exclude = false; |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | $record_exists = false; |
| 107 | 107 | $entry_username = $entry['0']; |
| 108 | 108 | |
| 109 | - $this->configuration = $this->getConfiguration(); |
|
| 109 | + $this->configuration = $this->getConfiguration(); |
|
| 110 | 110 | |
| 111 | 111 | if ($this->firstTime == "1") { |
| 112 | 112 | $this->firstTime = 0; |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | public function getRecords($selectFields) |
| 144 | 144 | { |
| 145 | 145 | $fromTable = $this->configuration['target_table']; |
| 146 | - $whereStatement = "pid = '".$this->configuration['pid']."'"; |
|
| 146 | + $whereStatement = "pid = '" . $this->configuration['pid'] . "'"; |
|
| 147 | 147 | |
| 148 | 148 | $GLOBALS['TYPO3_DB']->store_lastBuiltQuery = 1; |
| 149 | 149 | |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | public function updateRecord(array $entry) |
| 190 | 190 | { |
| 191 | 191 | $into_table = $this->configuration['target_table']; |
| 192 | - $whereStatement = "pid = '".$this->configuration['pid']."' AND username = '".$entry[0]."'"; |
|
| 192 | + $whereStatement = "pid = '" . $this->configuration['pid'] . "' AND username = '" . $entry[0] . "'"; |
|
| 193 | 193 | |
| 194 | 194 | $field_values = array(); |
| 195 | 195 | $tmp_arr = array(); |