/** * @return void */ protected function initializeAction() { parent::initializeAction(); $translationHelper = new TranslationHelper(); $this->setTitle($translationHelper->translate($this->moduleConfiguration['label']) . ' :: ' . $translationHelper->translate(str_replace('label', 'action.', $this->moduleConfiguration['label']) . $this->request->getControllerActionName())); if ($this->arguments->hasArgument('user')) { $propertyMappingConfigurationForUser = $this->arguments->getArgument('user')->getPropertyMappingConfiguration(); $propertyMappingConfigurationForUserName = $propertyMappingConfigurationForUser->forProperty('user.name'); $propertyMappingConfigurationForPrimaryAccount = $propertyMappingConfigurationForUser->forProperty('user.primaryAccount'); $propertyMappingConfigurationForPrimaryAccount->setTypeConverterOption(PersistentObjectConverter::class, PersistentObjectConverter::CONFIGURATION_TARGET_TYPE, Account::class); /** @var PropertyMappingConfiguration $propertyMappingConfiguration */ foreach (array($propertyMappingConfigurationForUser, $propertyMappingConfigurationForUserName, $propertyMappingConfigurationForPrimaryAccount) as $propertyMappingConfiguration) { $propertyMappingConfiguration->setTypeConverterOption(PersistentObjectConverter::class, PersistentObjectConverter::CONFIGURATION_MODIFICATION_ALLOWED, true); } } $this->currentUser = $this->userService->getCurrentUser(); }
/** * @return void */ protected function initializeUpdateAction() { $converter = new PersistentObjectConverter(); $this->arguments->getArgument('workspace')->getPropertyMappingConfiguration()->forProperty('owner')->setTypeConverter($converter)->setTypeConverterOption(PersistentObjectConverter::class, PersistentObjectConverter::CONFIGURATION_TARGET_TYPE, User::class); parent::initializeAction(); }