Sys_category In A Powermail Save Data Finisher
i want to write powermail data in the data table of an own extbase extension. the form delivers a uid of a sys_category which i want to persist in my extension.
The relevant lines in my finisher:
$obj = GeneralUtility::makeInstance('Vendor\myExt\Domain\Model\ProductRating'); $obj->setName('Huber'); $obj->setPrename('Hans'); // etc. $this->persistenceManager->add($obj); $this->persistenceManager->persistAll();
this works as expected, the entries are persisted in the data table. But now i want to persist the given sys_category. This:
$obj->setCategories(13); // 13 is the uid of the category
obvviously does not work ("expected parameter of type '\TYPO3\CMS\Extbase\Persistence\ObjectStorage', 'string' provided). I need to implement the ObjectStorage of sys_category but i don`t know how.
Very thankful for every hint ... !
You have to create a new instance of an ObjectStorage (e.g. $os = new ObjectStorage();) and now you can add an object to the objectStorage. After this you can use it in setCategories() function.
- → Prevent form action from being followed by robots
- → Render Link within Typoscript Controller
- → How can I implement the sitemaps for a TYPO3 Multidomainsystem when i have only one root folder?
- → TYPO3 - Overriding & adding meta tags (from tx_metaseo) on detail view of custom extension
- → How can i remove the region in TYPO3 9 SEO extension from hreflang
- → generate SEO sitemap for tt_address in TYPO3 and how to beautify with slugs
- → TYPO3 and IOS: can't open the page
- → TYPO3: How do i render tt_content text elements in my own extensions?
- → TYPO3 News Sitemap Configuration - actual date in additionalWhere statement
- → Check the Database of a typo3-Website
- → How to create a record and add an image in database in TYPO3
- → TYPO3 Frontent: Form Action results Page not found
- → RealURL with GET parameters