[TASK] Extbase-Repository: Use ClassNamingUtility from core 45/35345/4
authorStefan Neufeind <typo3.neufeind@speedpartner.de>
Sat, 13 Dec 2014 23:52:43 +0000 (00:52 +0100)
committerMarkus Klein <klein.t3@reelworx.at>
Tue, 16 Dec 2014 14:57:37 +0000 (15:57 +0100)
Use core-functionality for conversion of repository-name
to its model-name.

Change-Id: I2a3247dd05ea24f12d1c235d8bf39bebdfbdb9ff
Resolves: #63809
Releases: master
Reviewed-on: http://review.typo3.org/35345
Reviewed-by: Susanne Moog <typo3@susannemoog.de>
Tested-by: Susanne Moog <typo3@susannemoog.de>
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
typo3/sysext/extbase/Classes/Persistence/Repository.php

index 7335793..9483b5b 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Extbase\Persistence;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\ClassNamingUtility;
+
 /**
  * The base repository - will usually be extended by a more concrete repository.
  *
@@ -68,9 +70,7 @@ class Repository implements RepositoryInterface, \TYPO3\CMS\Core\SingletonInterf
         */
        public function __construct(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager) {
                $this->objectManager = $objectManager;
-
-               $nsSeparator = strpos($this->getRepositoryClassName(), '\\') !== FALSE ? '\\\\' : '_';
-               $this->objectType = preg_replace(array('/' . $nsSeparator . 'Repository' . $nsSeparator . '(?!.*' . $nsSeparator . 'Repository' . $nsSeparator . ')/', '/Repository$/'), array($nsSeparator . 'Model' . $nsSeparator, ''), $this->getRepositoryClassName());
+               $this->objectType = ClassNamingUtility::translateRepositoryNameToModelName($this->getRepositoryClassName());
        }
 
        /**