diff --git a/Classes/Controller/ProfileController.php b/Classes/Controller/ProfileController.php index 6338e1e..4cbfabb 100644 --- a/Classes/Controller/ProfileController.php +++ b/Classes/Controller/ProfileController.php @@ -393,6 +393,10 @@ public function addProfileInformationAction(Profile $profile, string $type): Res $profileInformation->setType($type); switch ($type) { + case 'scientific_research': + $profile->getScientificResearch()->attach($profileInformation); + $this->persistenceManager->update($profile); + break; case 'curriculum_vitae': $profile->getVita()->attach($profileInformation); $this->persistenceManager->update($profile); @@ -413,6 +417,10 @@ public function addProfileInformationAction(Profile $profile, string $type): Res $profile->getLectures()->attach($profileInformation); $this->persistenceManager->update($profile); break; + case 'press_media': + $profile->getPressMedia()->attach($profileInformation); + $this->persistenceManager->update($profile); + break; default: $addProfileInformationEvent = new AddProfileInformationEvent($profile, $profileInformation); $this->eventDispatcher->dispatch($addProfileInformationEvent); @@ -434,6 +442,10 @@ public function removeProfileInformationAction(Profile $profile, ProfileInformat } switch ($profileInformation->getType()) { + case 'scientific_research': + $profile->getScientificResearch()->detach($profileInformation); + $this->persistenceManager->update($profile); + break; case 'curriculum_vitae': $profile->getVita()->detach($profileInformation); $this->persistenceManager->update($profile); @@ -454,6 +466,10 @@ public function removeProfileInformationAction(Profile $profile, ProfileInformat $profile->getLectures()->detach($profileInformation); $this->persistenceManager->update($profile); break; + case 'press_media': + $profile->getPressMedia()->detach($profileInformation); + $this->persistenceManager->update($profile); + break; default: $removeProfileInformationEvent = new RemoveProfileInformationEvent($profile, $profileInformation); $this->eventDispatcher->dispatch($removeProfileInformationEvent); diff --git a/Classes/Domain/Model/Profile.php b/Classes/Domain/Model/Profile.php index 3e7ef1f..e3a1503 100644 --- a/Classes/Domain/Model/Profile.php +++ b/Classes/Domain/Model/Profile.php @@ -145,6 +145,32 @@ public function setLectures(ObjectStorage $lectures): void parent::setLectures($lectures); } + /** + * @param ObjectStorage $pressMedia + */ + public function setPressMedia(ObjectStorage $pressMedia): void + { + foreach ($pressMedia as $press) { + $press->setTitle($this->getHtmlSanitizer()->sanitize($press->getTitle())); + $press->setBodytext($this->getHtmlSanitizer()->sanitize($press->getBodytext())); + $press->setLink($this->getHtmlSanitizer()->sanitize($press->getLink())); + } + parent::setPressMedia($pressMedia); + } + + /** + * @param ObjectStorage $scientificResearch + */ + public function setScientificResearch(ObjectStorage $scientificResearch): void + { + foreach ($scientificResearch as $research) { + $research->setTitle($this->getHtmlSanitizer()->sanitize($research->getTitle())); + $research->setBodytext($this->getHtmlSanitizer()->sanitize($research->getBodytext())); + $research->setLink($this->getHtmlSanitizer()->sanitize($research->getLink())); + } + parent::setScientificResearch($scientificResearch); + } + public function getLanguageUid(): int { return $this->_languageUid;