/** * Wrapper method to execute a ConfigurationProvider * * @param string $methodName * @param string $table * @param mixed $id * @param array $record * @param array $arguments * @param DataHandler $reference * @return array */ protected function executeConfigurationProviderMethod($methodName, $table, $id, array $record, array $arguments, DataHandler $reference) { try { $id = $this->resolveRecordUid($id, $reference); $record = $this->ensureRecordDataIsLoaded($table, $id, $record); $arguments['row'] =& $record; $arguments[] =& $reference; $detectedProviders = $this->configurationService->resolveConfigurationProviders($table, NULL, $record); foreach ($detectedProviders as $provider) { if (TRUE === $provider->shouldCall($methodName, $id)) { call_user_func_array(array($provider, $methodName), array_values($arguments)); $provider->trackMethodCall($methodName, $id); } } } catch (\RuntimeException $error) { $this->configurationService->debug($error); } return $record; }
/** * Wrapper method to execute a ConfigurationProvider * * @param string $methodName * @param string $table * @param mixed $id * @param array $record * @param array $arguments * @param \TYPO3\CMS\Core\DataHandling\DataHandler $reference * @return void */ protected function executeConfigurationProviderMethod($methodName, $table, $id, array &$record, array &$arguments, &$reference) { try { if (FALSE !== strpos($id, 'NEW')) { $id = $reference->substNEWwithIDs[$id]; } $clause = "uid = '" . $id . "'"; if (0 === count($record)) { // patch: when a record is completely empty but a UID exists $loadedRecord = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', $table, $clause); if (TRUE === is_array($loadedRecord)) { $record = array_pop($loadedRecord); $arguments['row'] =& $record; } } $arguments[] =& $reference; // check for a registered generic ConfigurationProvider for $table $detectedProviders = array(); $providers = $this->configurationService->resolveConfigurationProviders($table, NULL, $record); foreach ($providers as $provider) { $class = get_class($provider); $detectedProviders[$class] = $provider; } // check each field for a registered ConfigurationProvider foreach ($record as $fieldName => $unusedValue) { $providers = $this->configurationService->resolveConfigurationProviders($table, $fieldName, $record); foreach ($providers as $provider) { $class = get_class($provider); $detectedProviders[$class] = $provider; } } foreach ($detectedProviders as $provider) { if (TRUE === $provider->shouldCall($methodName, $record)) { call_user_func_array(array($provider, $methodName), $arguments); $provider->trackMethodCall($methodName, $record); } } } catch (\Exception $error) { $this->configurationService->debug($error); } }