1
votes

I have TYPO3 7.6.18. I need to redeclare TYPO3\CMS\Extbase\Domain\Model\FrontendUser class and extend it with my new class Fhk\Feusersplus\Domain\Model\FrontendUser. I need that TYPO3 use my FrontEnd class. (I need add new upload field)

I tried:

ext_typoscript_setup.txt:

config.tx_extbase{
    persistence{
        classes{
            In2code\Femanager\Domain\Model\User {
                subclasses {
                    0 = Fhk\Feusersplus\Domain\Model\User
                }
            }
            TYPO3\CMS\Extbase\Domain\Model\FrontendUser{
                subclasses {
                    0 = Fhk\Feusersplus\Domain\Model\FrontendUser
                }
            }
            Fhk\Feusersplus\Domain\Model\User {
                mapping {
                    tableName = fe_users
                    recordType = 0
                }
            }
        }
    }
    objects {
        In2code\Femanager\Controller\NewController.className  = Fhk\Feusersplus\Controller\NewController
        In2code\Femanager\Controller\EditController.className = Fhk\Feusersplus\Controller\EditController
        In2code\Femanager\Controller\UserController.className = Fhk\Feusersplus\Controller\UserController
        #Kennziffer\KeQuestionnaire\Domain\Repository\ResultRepository.className = Fhk\Feusersplus\Domain\Repository\ResultRepository
    }
}

ext_localconf.php

$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects']['TYPO3\CMS\Extbase\Domain\Model\FrontendUser'] = array(
    'className' => 'Fhk\Feusersplus\Domain\Model\FrontendUser'
);

But I have error:

Exception while property mapping at property path "": Property "backgroundimage" was not found in target object of type "Fhk\Feusersplus\Domain\Model\User".

my file ext:Configuration/TCA/Overrides/fe_users.php

$tmp_feusersplus_columns = array(
    'backgroundimage' => [
        'exclude' => 1,
        'label' => 'Background image',
        'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
            'image', [
            'appearance' => [
                'createNewRelationLinkTitle' => 'LLL:EXT:cms/locallang_ttc.xlf:images.addFileReference'
            ],
            'maxitems' => 1,
            // custom configuration for displaying fields in the overlay/reference table
            // to use the imageoverlayPalette instead of the basicoverlayPalette
            'foreign_match_fields' => [
                'fieldname' => 'backgroundimage',
                'tablenames' => 'fe_users',
                'table_local' => 'sys_file',
            ],
            'foreign_types' => [
                '0' => [
                    'showitem' => '
                            --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
                            --palette--;;filePalette'
                ],
                \TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT => [
                    'showitem' => '
                            --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
                            --palette--;;filePalette'
                ],
                \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [
                    'showitem' => '
                            --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
                            --palette--;;filePalette'
                ],
                \TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => [
                    'showitem' => '
                            --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
                            --palette--;;filePalette'
                ],
                \TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => [
                    'showitem' => '
                            --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
                            --palette--;;filePalette'
                ],
                \TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => [
                    'showitem' => '
                            --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
                            --palette--;;filePalette'
                ]
            ]
        ], $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'])
    ],

);

And yes, I extend ext_tables with backgroundimage field

It's seems that TYPO3 not use my new FrontendUser class. Help me please anybody!

1
Did you extend ext_tables.sql and ext_tables.php with the definitions for the fields you added? You could use this as a guideline for what you would like to do (I think): docs.typo3.org/typo3cms/extensions/femanager/1.0.11/…taalas
I know it, but I can't make it work for image upload field ( stackoverflow.com/questions/43999558/… Can you help me. pleaseMikael
In localconf you used FrontendUser but in typoscript and in the error message it mentions User. Is one of those perhaps wrong?Nitori

1 Answers

1
votes

I don't think that there is a Problem with DB or TCA, most likely the property is just missing in your model Property "backgroundimage" was not found:

    protected $backgroundimage = null;

    public function getBackgroundimage()
    {
        return $this->backgroundimage;
    }