예제 #1
0
 /**
  * Commits the given command.
  *
  * @param int    $uidClip   Uid of clipboard item
  * @param int    $uidTarget Uid of target
  * @param string $command   Command
  */
 protected function commitCommand($uidClip, $uidTarget, $command)
 {
     // First prepare user defined hooks
     $hooks = \CommerceTeam\Commerce\Factory\HookFactory::getHooks('Utility/DataHandlerUtility', 'commitCommand');
     // Hook: beforeCommit
     foreach ($hooks as $hookObj) {
         if (method_exists($hookObj, 'beforeCommit')) {
             $hookObj->beforeCommit($uidClip, $uidTarget, $command);
         }
     }
     // we got all info we need - commit command
     switch ($command) {
         case 'overwrite':
             BackendUtility::overwriteProduct($uidClip, $uidTarget, $this->locales);
             break;
         case 'pasteProduct':
             BackendUtility::copyProduct($uidClip, $uidTarget, false, $this->locales, $this->sorting);
             break;
         case 'pasteCategory':
             BackendUtility::copyCategory($uidClip, $uidTarget, $this->locales, $this->sorting);
             break;
         default:
             die('unknown command');
     }
     // Hook: afterCommit
     foreach ($hooks as $hookObj) {
         if (method_exists($hookObj, 'afterCommit')) {
             $hookObj->afterCommit($uidClip, $uidTarget, $command);
         }
     }
     // Update page tree?
     if ($this->uPT && (isset($this->data['tx_commerce_categories']) || isset($this->cmd['tx_commerce_categories'])) && (isset($this->data['tx_commerce_products']) || isset($this->cmd['tx_commerce_products']))) {
         \TYPO3\CMS\Backend\Utility\BackendUtility::setUpdateSignal('updateFolderTree');
     }
 }