0

In my service class I have

/**
 * @var \TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository
 * @inject
 */
protected $frontendUserRepository;

/**
 * @var \TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager
 * @inject
 */
protected $persistenceManager;

And in a function:

$objectManager = GeneralUtility::makeInstance('TYPO3\CMS\Extbase\Object\ObjectManager');
$this->frontendUserRepository = $objectManager->get('TYPO3\\CMS\\Extbase\\Domain\\Repository\\FrontendUserRepository');
$frontendUser = new FrontendUser();
$frontendUser->setUsername($bla);
$frontendUser->setPassword($bliep);
$this->frontendUserRepository->add($frontendUser);
$this->persistenceManager = $objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\PersistenceManager');
$this->persistenceManager->persistAll();

Then I get error

Table 'dbname.tx_extbase_domain_model_frontenduser' doesn't exist

How can I store the new user in the 'fe_users' table?

  • 1
    does this help? : https://stackoverflow.com/questions/17928551/mapping-to-pages-table-from-extbase-in-typo3-6-1 – David Oct 18 '18 at 16:53
  • I see there something like `config.tx_extbase.persistence.classesTx_Extname_Domain_Model_Member.mapping.tableName=fe_users` But I don't have a model? – Jacco van der Post Oct 18 '18 at 17:00
  • Thx for the direction. I guess I need a model for a mapping, so I decided for now to insert the new user directly with a Doctrine-Dbal insert query. – Jacco van der Post Oct 18 '18 at 17:36
  • Extbase has a model for FE-Users. You can use that. – David Oct 18 '18 at 23:01
  • But, I am not sure, it looks like you need to make a own model, (extend the FE-users model), to be able to map. – Jacco van der Post Oct 19 '18 at 09:01
  • Your error will normally be solved with the solution David and Michiel mentioned, if your typoscript is included correct. I often use file ext_typoscript_setup.txt in my extension to include such configuration automaticly at rootline. – jokumer Oct 20 '18 at 08:43

1 Answers1

2

Make a table mapping in your TypoScript setup extbase configuration:

config.tx_extbase {
    persistence {
        classes {
            TYPO3\CMS\Extbase\Domain\Model\FrontendUser {
                mapping {
                    tableName = fe_users
                }
            }
        }
    }
}
Michiel Roos
  • 863
  • 11
  • 13
  • I have extended the frontenduser, but a mapping seems to get ignored in a service class. I guess the typoscript needs to be loaded there. However I think after trying a while to just use Doctrine. Thx! – Jacco van der Post Oct 19 '18 at 12:57