Extbase:
authorJochen Rau <j.rau@web.de>
Sat, 16 May 2009 16:38:27 +0000 (16:38 +0000)
committerJochen Rau <j.rau@web.de>
Sat, 16 May 2009 16:38:27 +0000 (16:38 +0000)
* Changed all method calls using Tx_Extbase_Utility_Strings to the correspondant t3lib_div methods
* Deleted Tx_Extbase_Utility_Strings

typo3/sysext/extbase/Classes/Dispatcher.php
typo3/sysext/extbase/Classes/MVC/Request.php
typo3/sysext/extbase/Classes/Persistence/Hook/TCEMainValueObjectUpdater.php
typo3/sysext/extbase/Classes/Persistence/Mapper/ColumnMap.php
typo3/sysext/extbase/Classes/Persistence/Repository.php
typo3/sysext/extbase/Classes/Utility/Strings.php [deleted file]
typo3/sysext/extbase/ext_typoscript_setup.txt [deleted file]

index 4d685c6..5adf401 100644 (file)
@@ -22,8 +22,6 @@
 *  This copyright notice MUST APPEAR in all copies of the script!
 ***************************************************************/
 
-require_once(t3lib_extMgm::extPath('extbase') . 'Classes/Utility/Strings.php');
-
 /**
  * Creates a request an dispatches it to the controller which was specified
  * by TS Setup, Flexform and returns the content to the v4 framework.
@@ -65,7 +63,6 @@ class Tx_Extbase_Dispatcher {
                        }
                }
 
-               // var_dump($persistenceSession);
                $persistenceSession->commit();
                $persistenceSession->clear();
                if (count($response->getAdditionalHeaderData()) > 0) {
@@ -132,14 +129,14 @@ class Tx_Extbase_Dispatcher {
         */
        public static function autoloadClass($className) {
                $classNameParts = explode('_', $className);
-               $extensionKey = Tx_Extbase_Utility_Strings::camelCaseToLowerCaseUnderscored($classNameParts[1]);
+               $extensionKey = t3lib_div::camelCaseToLowerCaseUnderscored($classNameParts[1]);
                if (t3lib_extMgm::isLoaded($extensionKey)) {
                        if ($classNameParts[0] === 'ux') {
                                array_shift($classNameParts);
                        }
                        $className = implode('_', $classNameParts);
                        if (count($classNameParts) > 2 && $classNameParts[0] === 'Tx') {
-                               $classFilePathAndName = t3lib_extMgm::extPath(Tx_Extbase_Utility_Strings::camelCaseToLowerCaseUnderscored($classNameParts[1])) . 'Classes/';
+                               $classFilePathAndName = t3lib_extMgm::extPath(t3lib_div::camelCaseToLowerCaseUnderscored($classNameParts[1])) . 'Classes/';
                                $classFilePathAndName .= implode(array_slice($classNameParts, 2, -1), '/') . '/';
                                $classFilePathAndName .= array_pop($classNameParts) . '.php';
                        }
index e96c6c1..526a32c 100644 (file)
@@ -230,7 +230,7 @@ class Tx_Extbase_MVC_Request {
         * @return string The extension name
         */
        public function getControllerExtensionKey() {
-               return Tx_Extbase_Utility_Strings::camelCaseToLowerCaseUnderscored($this->controllerExtensionName);
+               return t3lib_div::camelCaseToLowerCaseUnderscored($this->controllerExtensionName);
        }
 
        /**
index 4525e3e..c0c836f 100644 (file)
@@ -1,6 +1,8 @@
 <?php
 /* WE NEED TO DO IT STRTOLOWER */
 class tx_Extbase_Persistence_Hook_TCEMainValueObjectUpdater {
+       
+       // TODO PHPDoc
        public function processDatamap_preProcessFieldArray(&$incomingFieldArray, $table, &$id, $tcemain) {
                global $TCA;
                if (isset($TCA[$table]['ctrl']['objectType']) && $TCA[$table]['ctrl']['objectType'] === 'ValueObject') {
@@ -15,8 +17,6 @@ class tx_Extbase_Persistence_Hook_TCEMainValueObjectUpdater {
                                        $id = (int)$uid;
                                        unset($incomingFieldArray['pid']);
                                }
-                               //var_dump($incomingFieldArray, $table, $id, $uid);
-                               //
                                //$incomingFieldArray['uid'] = $uid;
                        } else {
                                // We did not find an already existing entry with the same values in the DB
@@ -30,6 +30,7 @@ class tx_Extbase_Persistence_Hook_TCEMainValueObjectUpdater {
                }
        }
 
+       // TODO PHPDoc
        protected function findUid($incomingFieldArray, $table) {
                $whereClauseArray = array();
                unset($incomingFieldArray['uid']);
index f035122..c5ed090 100644 (file)
@@ -130,7 +130,7 @@ class Tx_Extbase_Persistence_Mapper_ColumnMap {
        public function __construct($columnName) {
                // TODO Enable aliases (tx_anotherextension_addedcolumn -> theAddedColumn)
                $this->setColumnName($columnName);
-               $this->setPropertyName(Tx_Extbase_Utility_Strings::underscoredToLowerCamelCase($columnName));
+               $this->setPropertyName(t3lib_div::underscoredToLowerCamelCase($columnName));
        }
 
        public function setTypeOfRelation($typeOfRelation) {
index 342d9b4..7c8328a 100644 (file)
@@ -162,10 +162,10 @@ class Tx_Extbase_Persistence_Repository implements Tx_Extbase_Persistence_Reposi
         */
        public function __call($methodName, $arguments) {
                if (substr($methodName, 0, 6) === 'findBy' && strlen($methodName) > 7) {
-                       $propertyName = Tx_Extbase_Utility_Strings::lowercaseFirst(substr($methodName,6));
+                       $propertyName = strtolower(substr(substr($methodName,6),0,1) ) . substr(substr($methodName,6),1);
                        return $this->findByConditions(array($propertyName => $arguments[0]));
                } elseif (substr($methodName, 0, 9) === 'findOneBy' && strlen($methodName) > 10) {
-                       $propertyName = Tx_Extbase_Utility_Strings::lowercaseFirst(substr($methodName,9));
+                       $propertyName = strtolower(substr(substr($methodName,9),0,1) ) . substr(substr($methodName,9),1);
                        $result = $this->findByConditions(array($propertyName => $arguments[0]), '', '', 1);
                        if (count($result) > 0) {
                                return $result[0];
diff --git a/typo3/sysext/extbase/Classes/Utility/Strings.php b/typo3/sysext/extbase/Classes/Utility/Strings.php
deleted file mode 100644 (file)
index b40759f..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
-*  All rights reserved
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-
-/**
- * A collection of utilities for extensions
- *
- * @package TYPO3
- * @subpackage extbase
- * @version $ID:$
- */
-abstract class Tx_Extbase_Utility_Strings {
-       
-       /**
-        * Returns a given string with underscores as UpperCamelCase (not UTF8 safe)
-        *
-        * @param string String to be converted to camel case
-        * @return string UpperCamelCasedWord
-        */
-       public static function underscoredToUpperCamelCase($string) {
-               $upperCamelCase = str_replace(' ', '', ucwords(str_replace('_', ' ', strtolower($string))));
-               return $upperCamelCase;
-       }
-       
-       /**
-        * Returns a given string with underscores as lowerCamelCase (not UTF8 safe)
-        *
-        * @param string String to be converted to camel case
-        * @return string lowerCamelCasedWord
-        */
-       public static function underscoredToLowerCamelCase($string) {
-               $upperCamelCase = str_replace(' ', '', ucwords(str_replace('_', ' ', strtolower($string))));
-               $lowerCamelCase = strtolower(substr($upperCamelCase,0,1) ) . substr($upperCamelCase,1);
-               return $lowerCamelCase;
-       }
-       
-       /**
-        * Returns a given CamelCasedString as an lowercase string with underscores (not UTF8 safe)
-        *
-        * @param string String to be converted to lowercase underscore
-        * @return string lowercase_and_underscored_string
-        */
-       public static function camelCaseToLowerCaseUnderscored($string) {
-               return strtolower(preg_replace('/(?<=\w)([A-Z])/', '_\\1', $string));
-       }
-               
-       /**
-        * Sets the first char of a string to lowercase (not UTF8 safe)
-        *
-        * @param string $string 
-        * @return void
-        */
-       public static function lowercaseFirst($string) {
-               return strtolower(substr($string,0,1) ) . substr($string,1);
-       }
-       
-       /**
-        * Returns the extension key. Automatically detects the extension key from the classname.
-        *
-        * @return string The extension key
-        */
-       public static function getExtensionKey() {
-               // TODO Implement Tx_Extbase_Utility_Strings::getExtensionKey()
-               // if(preg_match('/^Tx_([^_]+)/', get_class($this), $matches)) {
-               //      $possibleExtensionKey = $matches[1];
-               //      if($possibleExtensionKey != 'lib') {
-               //              $loadedExtensionKeys = t3lib_div::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['EXT']['extList']);
-               //              foreach($loadedExtensionKeys as $extensionKey) {
-               //                      if($possibleExtensionKey == str_replace('_', '', $extensionKey)) {
-               //                              return $extensionKey;
-               //                      }
-               //              }
-               //      }
-               // }
-       }
-       
-}
-?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/ext_typoscript_setup.txt b/typo3/sysext/extbase/ext_typoscript_setup.txt
deleted file mode 100644 (file)
index 1a91384..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-plugin.tx_extbase {
-       
-}
\ No newline at end of file