[TYPO3-mvc] Get repository object from table name
Thomas "Thasmo" Deinhamer
thasmo at gmail.com
Thu Jan 27 12:59:11 CET 2011
Franz Koch wrote:
> But to answer your question - I don't know of such a method (yet). In
> extbase code like this is used:
>
> $modelClassName = t3lib_div::underscoredToUpperCamelCase($tableName);
> $repositoryClassName = str_replace('_Model_', '_Repository_',
> $modelClassName) . 'Repository';
Thanks for your answer! Unfortunately this wasn't working well,
because it created a class name without underscores, like:
"TxExtDomainRepositoryRecordRepository"
I used this now:
$modelClassName = str_replace(' ', '_', ucwords(str_replace('_', ' ',
t3lib_div::strtolower($tableName))));
$repositoryClassName = str_replace('_Model_', '_Repository_',
$modelClassName) . 'Repository';
Thanks a lot anyway!
Best regards,
Thomas
More information about the TYPO3-project-typo3v4mvc
mailing list