Skip to content

Instantly share code, notes, and snippets.

View christophlehmann's full-sized avatar

Christoph Lehmann christophlehmann

View GitHub Profile
@einpraegsam
einpraegsam / MysqlXml.txt
Created October 2, 2019 07:25
MySQL: Read and write values from XML (e.g. TYPO3 FlexForm)
# Read: Show real path in sys_file_storage
select name, uid, ExtractValue(configuration, '//T3FlexForms/data/sheet[@index="sDEF"]/language/field[@index="basePath"]/value') path from sys_file_storage where uid > 0
# Write: Set a new value (in this case a detail pid) in FlexForm of a tt_news plugin
UPDATE tt_content SET pi_flexform = UpdateXML(pi_flexform, '//T3FlexForms/data/sheet[@index="s_misc"]/language/field[@index="PIDitemDisplay"]/value', CONCAT('<value index="vDEF">', 123, '</value>' )) WHERE uid=11107
@einpraegsam
einpraegsam / datamappingExtbase.php
Last active November 3, 2023 16:15
Use DataMapper class in TYPO3 to convert an array into an object
public function mapProperties(): AnyModel
{
$properties = [
'uid' => 123,
'pid' => 123,
'firstname' => 'Alex',
'lastname' => 'Kellner'
'email' => 'my@email.org'
];
$dataMapper = $this->objectManager->get(TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::class);