Extbase:
authorJochen Rau <j.rau@web.de>
Sat, 16 May 2009 16:54:59 +0000 (16:54 +0000)
committerJochen Rau <j.rau@web.de>
Sat, 16 May 2009 16:54:59 +0000 (16:54 +0000)
* Removed all Query related class files and tests (will be reverted after TYPO3 4.3alpha3 was released)

typo3/sysext/extbase/Classes/MVC/Controller/Argument.php
typo3/sysext/extbase/Classes/Persistence/ConstraintInterface.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/Query.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QueryFactory.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QueryFactoryInterface.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QueryInterface.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/RawSqlConstraint.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/Repository.php
typo3/sysext/extbase/Classes/Persistence/SqlConstraint.php [deleted file]
typo3/sysext/extbase/Tests/Persistence/QueryFactory_testcase.php [deleted file]
typo3/sysext/extbase/Tests/Persistence/Query_testcase.php [deleted file]

index 5ad52df..253612e 100644 (file)
@@ -98,7 +98,7 @@ class Tx_Extbase_MVC_Controller_Argument {
         * @throws InvalidArgumentException if $name is not a string or empty
         */
        public function __construct($name, $dataType = 'Text') {
-               $this->queryFactory = t3lib_div::makeInstance('Tx_Extbase_Persistence_QueryFactory');
+               // $this->queryFactory = t3lib_div::makeInstance('Tx_Extbase_Persistence_QueryFactory');
                $this->propertyMapper = t3lib_div::makeInstance('Tx_Extbase_Property_Mapper');
                if (!is_string($name) || strlen($name) < 1) throw new InvalidArgumentException('$name must be of type string, ' . gettype($name) . ' given.', 1187951688);
                $this->name = $name;
diff --git a/typo3/sysext/extbase/Classes/Persistence/ConstraintInterface.php b/typo3/sysext/extbase/Classes/Persistence/ConstraintInterface.php
deleted file mode 100644 (file)
index 7cf46e3..0000000
+++ /dev/null
@@ -1,36 +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!
-***************************************************************/
-
-/**
- * The interface for constraints
- *
- * @package TYPO3
- * @subpackage Extbase
- * @version $Id$
- * @scope prototype
- */
-interface Tx_Extbase_Persistence_ConstraintInterface {
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/Query.php b/typo3/sysext/extbase/Classes/Persistence/Query.php
deleted file mode 100644 (file)
index 5ac8e95..0000000
+++ /dev/null
@@ -1,153 +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!
-***************************************************************/
-
-/**
- * The Query classs used to run queries against the database
- *
- * @package TYPO3
- * @subpackage Extbase
- * @version $Id$
- * @scope prototype
- */
-class Tx_Extbase_Persistence_Query implements Tx_Extbase_Persistence_QueryInterface {
-
-       /**
-        * @var string
-        */
-       protected $className;
-
-       /**
-        * @var Tx_Extbase_Persistence_DataMapperInterface
-        */
-       protected $dataMapper;
-
-       /**
-        * @var Tx_Extbase_Persistence_Session
-        */
-       protected $persistenceSession;
-               
-       /**
-        * @var Tx_Extbase_Persistence_ConstraintInterface
-        */
-       protected $constraint;
-
-       /**
-        * Constructs a query object working on the given class name
-        *
-        * @param string $className
-        */
-       public function __construct($className) {
-               $this->className = $className;
-       }
-
-       /**
-        * Injects the persistence backend to fetch the data from
-        *
-        * @param t3lib_DB $persistenceBackend
-        * @return void
-        */
-       public function injectPersistenceBackend(t3lib_DB $persistenceBackend) {
-               $this->persistenceBackend = $persistenceBackend;
-       }
-
-       /**
-        * Injects the DataMapper to map nodes to objects
-        *
-        * @param Tx_Extbase_Persistence_DataMapperInterface $dataMapper
-        * @return void
-        */
-       public function injectDataMapper(Tx_Extbase_Persistence_DataMapperInterface $dataMapper) {
-               $this->dataMapper = $dataMapper;
-       }
-
-       /**
-        * Executes the query against the database and returns the result
-        *
-        * @return array The query result as an array of objects
-        */
-       public function execute() {
-               $statement = $constraint->getStatement();
-               $res = $this->database->exec_SELECTquery(
-                       '*',
-                       $from,
-                       $where . $enableFields,
-                       $groupBy,
-                       $orderBy,
-                       $limit
-                       );
-
-               if ($res) {
-                       $fieldMap = $this->getFieldMapFromResult($res);
-                       $rows = $this->getRowsFromResult($dataMap->getTableName(), $res);
-               }
-
-               $objects = array();
-               if (is_array($rows)) {
-                       if (count($rows) > 0) {
-                               $objects = $this->dataMapper->reconstituteObjects($dataMap, $fieldMap, $rows);
-                       }
-               }
-               return $objects;
-       }
-       
-       /**
-        * The constraint used to limit the result set
-        *
-        * @param Tx_Extbase_Persistence_ConstraintInterface $constraint Some constraint, depending on the backend
-        * @return Tx_Extbase_Persistence_QueryInterface
-        */
-       public function matching(Tx_Extbase_Persistence_ConstraintInterface $constraint) {
-               $this->constraint = $constraint;
-               return $this;
-       }
-       
-       protected function getRowsFromResult($tableName, $res) {
-               $rows = array();
-               while ($row = $this->persistenceBackend->sql_fetch_assoc($res)) {
-                       $row = $this->doLanguageAndWorkspaceOverlay($tableName, $row);
-                       if (is_array($row)) {
-                               $arrayKeys = range(0,count($row));
-                               array_fill_keys($arrayKeys, $row);
-                               $rows[] = $row;
-                       }
-               }
-               $this->persistenceBackend->sql_free_result($res);
-               return $rows;
-       }
-       
-       protected function getFieldMapFromResult($res) {
-               $fieldMap = array();
-               if ($res !== FALSE) {
-                       $fieldPosition = 0;
-                       // TODO mysql_fetch_field should be available in t3lib_db (patch core)
-                       while ($field = mysql_fetch_field($res)) {
-                               $fieldMap[$field->table][$field->name] = $fieldPosition;
-                               $fieldPosition++;
-                       }
-               }
-               return $fieldMap;
-       }
-       
-}
-?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/QueryFactory.php b/typo3/sysext/extbase/Classes/Persistence/QueryFactory.php
deleted file mode 100644 (file)
index b42a683..0000000
+++ /dev/null
@@ -1,51 +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!
-***************************************************************/
-
-/**
- * The QueryFactory used to create queries against the storage backend
- *
- * @package TYPO3
- * @subpackage Extbase
- * @version $Id$
- */
-class Tx_Extbase_Persistence_QueryFactory implements Tx_Extbase_Persistence_QueryFactoryInterface {
-
-       /**
-        * Creates a query object working on the given class name
-        *
-        * @param string $className
-        * @return Tx_Extbase_Persistence_Query
-        */
-       public function create($className) {
-               // TODO Make the Query class configurable
-               $query = t3lib_div::makeInstance('Tx_Extbase_Persistence_Query', $className);
-               // TODO Make the responsible Persistence Backend configurable
-               $query->injectPersistenceBackend($GLOBALS['TYPO3_DB']);
-               // TODO Make the responsible Data Mapper configurable
-               $query->injectDataMapper(t3lib_div::makeInstance('Tx_Extbase_Persistence_Mapper_ObjectRelationalMapper', $GLOBALS['TYPO3_DB']));
-               return $query;
-       }
-
-}
-?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/QueryFactoryInterface.php b/typo3/sysext/extbase/Classes/Persistence/QueryFactoryInterface.php
deleted file mode 100644 (file)
index 56fc545..0000000
+++ /dev/null
@@ -1,43 +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 persistence query factory interface
- *
- * @package TYPO3
- * @subpackage Extbase
- * @version $Id$
- */
-interface Tx_Extbase_Persistence_QueryFactoryInterface {
-
-       /**
-        * Creates a query object working on the given class name
-        *
-        * @param string $className
-        * @return Tx_Extbase_Persistence_QueryInterface
-        */
-       public function create($className);
-
-}
-?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/QueryInterface.php b/typo3/sysext/extbase/Classes/Persistence/QueryInterface.php
deleted file mode 100644 (file)
index 8ad89fa..0000000
+++ /dev/null
@@ -1,50 +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 persistence query interface
- *
- * @package TYPO3
- * @subpackage Extbase
- * @version $Id$
- */
-interface Tx_Extbase_Persistence_QueryInterface {
-
-       /**
-        * Executes the query against the backend and returns the result
-        *
-        * @return array The query result, an array of objects
-        */
-       public function execute();
-       
-       /**
-        * The constraint used to limit the result set
-        *
-        * @param Tx_Extbase_Persistence_ConstraintInterface $constraint Some constraint, depending on the backend
-        * @return Tx_Extbase_Persistence_QueryInterface
-        */
-       public function matching(Tx_Extbase_Persistence_ConstraintInterface $constraint);
-
-}
-?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/RawSqlConstraint.php b/typo3/sysext/extbase/Classes/Persistence/RawSqlConstraint.php
deleted file mode 100644 (file)
index 29b03f2..0000000
+++ /dev/null
@@ -1,73 +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!
-***************************************************************/
-
-/**
- * The interface for constraints
- *
- * @package TYPO3
- * @subpackage Extbase
- * @version $Id$
- * @scope prototype
- */
-class Tx_Extbase_Persistence_RawSqlConstraint implements Tx_Extbase_Persistence_ConstraintInterface {
-       
-       /**
-        * The SQL statement
-        *
-        * @var string
-        **/
-       protected $statement;
-       
-       /**
-        * Constructs this constraint
-        *
-        * @param string $statement 
-        */
-       public function __construct($statement) {
-               $this->setStatement($statement);
-       }
-       
-       /**
-        * Sets the statement
-        *
-        * @param string $statement 
-        * @return void
-        */
-       public function setStatement($statement) {
-               if (!is_string($statement)) throw new InvalidArgumentException('The statement must be of type string, ' . gettype($statement) . ' given.', 1187951688);
-               $this->statement = $statement;
-       }
-       
-       /**
-        * Returns the statement
-        *
-        * @return string The SQL statement
-        */
-       public function getStatement() {
-               return $this->statement;
-       }
-       
-}
-
-?>
\ No newline at end of file
index 7c8328a..616fb83 100644 (file)
@@ -73,7 +73,7 @@ class Tx_Extbase_Persistence_Repository implements Tx_Extbase_Persistence_Reposi
                }
                $this->dataMapper = t3lib_div::makeInstance('Tx_Extbase_Persistence_Mapper_ObjectRelationalMapper', $GLOBALS['TYPO3_DB']); // singleton
                $this->persistenceSession = t3lib_div::makeInstance('Tx_Extbase_Persistence_Session'); // singleton
-               $this->queryFactory = t3lib_div::makeInstance('Tx_Extbase_Persistence_QueryFactory');
+               // $this->queryFactory = t3lib_div::makeInstance('Tx_Extbase_Persistence_QueryFactory');
        }
 
        /**
@@ -110,28 +110,12 @@ class Tx_Extbase_Persistence_Repository implements Tx_Extbase_Persistence_Reposi
                        $this->dataMapper->replaceObject($existingObject, $newObject);
                        $this->persistenceSession->unregisterReconstitutedObject($existingObject);
                        $this->persistenceSession->registerReconstitutedObject($newObject);
-
-                       // if ($this->removedObjects->contains($existingObject)) {
-                       //      $this->removedObjects->detach($existingObject);
-                       //      $this->removedObjects->attach($newObject);
-                       // }
-               // } elseif ($this->addedObjects->contains($existingObject)) {
-                       // $this->addedObjects->detach($existingObject);
-                       // $this->addedObjects->attach($newObject);
                } else {
-                       throw new Tx_Extbase_Persistence_Exception_UnknownObject('The "existing object" is unknown to the persistence backend.', 1238068475);
+                       throw new Tx_Extbase_Persistence_Exception_UnknownObject('The "existing object" is unknown to the repository.', 1238068475);
                }
        }
        
        // TODO Implement Query Object
-       // /**
-       //  * Returns all objects of this repository
-       //  *
-       //  * @return array An array of objects, empty if no objects found
-       //  */
-       // public function findAll() {
-       //      return $this->createQuery()->execute();
-       // }
        
        /**
         * Returns all objects of this repository
diff --git a/typo3/sysext/extbase/Classes/Persistence/SqlConstraint.php b/typo3/sysext/extbase/Classes/Persistence/SqlConstraint.php
deleted file mode 100644 (file)
index 23cf81e..0000000
+++ /dev/null
@@ -1,241 +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!
-***************************************************************/
-
-/**
- * The interface for constraints
- *
- * @package TYPO3
- * @subpackage Extbase
- * @version $Id$
- * @scope prototype
- */
-class Tx_Extbase_Persistence_SqlConstraint implements Tx_Extbase_Persistence_ConstraintInterface {
-       
-       /**
-        * @var string
-        */
-       protected $where;
-
-       /**
-        * @var string
-        */
-       protected $groupBy;
-
-       /**
-        * @var string
-        */
-       protected $orderBy;
-
-       /**
-        * @var integer
-        */
-       protected $limit;
-
-       /**
-        * @var integer
-        */
-       protected $offset;
-       
-       /**
-        * @var boolean
-        */
-       protected $useEnableFields = TRUE;
-
-       /**
-        * The SQL statement
-        *
-        * @var string
-        **/
-       protected $statement;
-               
-       /**
-        * Sets the statement
-        *
-        * @param string $statement 
-        * @return void
-        */
-       public function setStatement($statement) {
-               if (!is_string($statement)) throw new InvalidArgumentException('The statement must be of type string, ' . gettype($statement) . ' given.', 1187951688);
-               $this->statement = $statement;
-       }
-       
-       /**
-        * Returns the statement
-        *
-        * @return string The SQL statement
-        */
-       public function getStatement() {
-               
-
-       }
-       
-       /**
-        * Sets the WHERE Statement
-        *
-        * @param string $where The WHERE statement
-        * @return void
-        */
-       public function setWhereClause($where) {
-               if (!is_string($where)) throw new InvalidArgumentException('The where clause must be of type string, ' . gettype($where) . ' given.', 1187951688);
-               $this->where = $where;
-       }
-
-       /**
-        * Sets the GROUP BY Statement
-        *
-        * @param string $groupBy The GROUP BY statement
-        * @return void
-        */
-       public function setGroupByClause($groupBy) {
-               if (!is_string($groupBy)) throw new InvalidArgumentException('The group by clause must be of type string, ' . gettype($groupBy) . ' given.', 1187951688);
-               $this->groupBy = $groupBy;
-       }
-
-       /**
-        * Sets the ORDER BY Statement
-        *
-        * @param string $orderBy The ORDER BY statement
-        * @return void
-        */
-       public function setOrderByClause($orderBy) {
-               if (!is_string($orderBy)) throw new InvalidArgumentException('The order by clause must be of type string, ' . gettype($orderBy) . ' given.', 1187951688);
-               $this->orderBy = $orderBy;
-       }
-
-       /**
-        * Sets the maximum size of the result set to limit.
-        *
-        * @param integer $limit
-        * @return void
-        */
-       public function setLimit($limit) {
-               if ($limit < 1 || !is_int($limit)) {
-                       throw new InvalidArgumentException('setLimit() accepts only integers greater than 0.', 1217244746);
-               }
-               $this->limit = $limit;
-       }
-
-       /**
-        * Sets the start offset of the result set to offset.
-        *
-        * @param integer $offset
-        * @return void
-        */
-       public function setOffset($offset) {
-               if ($offset < 0 || !is_int($offset)) {
-                       throw new InvalidArgumentException('setOffset() accepts only integers greater than or equal to 0.', 1217245454);
-               }
-               $this->offset = $offset;
-       }
-       
-       /**
-        * The following condition array would find entities with description like the given keyword and
-        * name equal to "foo".
-        *
-        * <pre>
-        * array(
-        *              array('blog_description LIKE ?', $keyword),
-        *              'blogName' => 'Foo'
-        *              )
-        * </pre>
-        *
-        * Note: The SQL part uses the database columns names, the query by example syntax uses
-        * the object property name (camel-cased, without underscore).
-        *
-        * @param Tx_Extbase_Persistence_Mapper_DataMap $dataMap The data map
-        * @param Tx_Extbase_Persistence_ConstraintInterface $constraint The constraint
-        * @return string The query where part for the class and given conditions
-        */
-       public function generateWhereClause(Tx_Extbase_Persistence_Mapper_DataMap $dataMap, Tx_Extbase_Persistence_ConstraintInterface $constraint) {
-               $where = '';
-               if (is_array($constraint)) {
-                       $whereParts = array();
-                       foreach ($constraint as $key => $condition) {
-                               if (is_array($condition) && isset($condition[0])) {
-                                       $sql = $this->replacePlaceholders($dataMap, $condition[0], array_slice($condition, 1));
-                                       $whereParts[] = '(' . $sql . ')';
-                               } elseif (is_string($key)) {
-                                       $sql = $this->generateWhereClauseByExample($dataMap, $key, $condition);
-                                       if (strlen($sql) > 0) {
-                                               $whereParts[] = '(' . $sql . ')';
-                                       }
-                               }
-                       }
-                       $where = (implode(' AND ', $whereParts));
-               } if (is_string($constraint)) {
-                       $where = $constraint;
-               }
-               return $where;
-       }
-       
-       /**
-        * Replace query placeholders in a query part by the given
-        * parameters.
-        *
-        * @param string $queryPart The query part with placeholders
-        * @param array $parameters The parameters
-        *
-        * @return string The query part with replaced placeholders
-        */
-       protected function replacePlaceholders(Tx_Extbase_Persistence_Mapper_DataMap $dataMap, $queryPart, $parameters) {
-               $sql = $queryPart;
-               foreach ($parameters as $parameter) {
-                       $markPosition = strpos($sql, '?');
-                       if ($markPosition !== FALSE) {
-                               $sql = substr($sql, 0, $markPosition) . $dataMap->convertPropertyValueToFieldValue($parameter) . substr($sql, $markPosition + 1);
-                       }
-               }
-               return $sql;
-       }
-       
-       
-       /**
-        * Get a where part for an example condition (associative array). This also works
-        * for nested conditions.
-        *
-        * @param Tx_Extbase_Persistence_Mapper_DataMap $dataMap The data map
-        * @param array $propertyName The property name
-        * @param array $example The example condition
-        *
-        * @return string The where part
-        */
-       protected function generateSqlByExample(Tx_Extbase_Persistence_Mapper_DataMap $dataMap, $propertyName, $example) {
-               $columnMap = $dataMap->getColumnMap($propertyName);
-               $sql = '';
-               if (empty($columnMap)) {
-                       throw new Tx_Extbase_Persistence_Exception_InvalidPropertyType("No columnMap for $propertyName", 1240305176);
-               }
-               if (!is_array($example)) {
-                       $column = $dataMap->getTableName() . '.' . $columnMap->getColumnName();
-                       $sql = $column . ' = ' . $dataMap->convertPropertyValueToFieldValue($example);
-               } else {
-                       $childDataMap = $this->dataMapper->getDataMap($columnMap->getChildClassName());
-                       $sql = $this->generateWhereClause($childDataMap, $example);
-               }
-               return $sql;
-       }
-       
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Tests/Persistence/QueryFactory_testcase.php b/typo3/sysext/extbase/Tests/Persistence/QueryFactory_testcase.php
deleted file mode 100644 (file)
index 68b4769..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2009 Christopher Hlubek <hlubek@networkteam.com>
-*  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!
-***************************************************************/
-
-class Tx_Extbase_Persistence_QueryFactory_testcase extends Tx_Extbase_Base_testcase {
-
-       public function test_createIsInvokedOnce() {
-               $queryFactory = $this->getMock('Tx_Extbase_Persistence_QueryFactory', array('create'));
-               $queryFactory->expects($this->once())
-                       ->method('create')
-                       ->with($this->equalTo('MyClassName'));
-               $query = $queryFactory->create('MyClassName');
-       }
-
-       public function test_queryFactoryCanCreateQuery() {
-               $queryFactory = new Tx_Extbase_Persistence_QueryFactory;
-               $query = $queryFactory->create('Tx_Extbase_Persistence_QueryFactory'); // TODO Encapsulate t3lib_div::makeInstance() to make it mockable
-               $this->assertTrue(in_array('Tx_Extbase_Persistence_QueryInterface', class_implements($query)), 'The query was not an instance of Tx_Extbase_Persistence_QueryInterface');
-               
-       }
-
-}
-?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Tests/Persistence/Query_testcase.php b/typo3/sysext/extbase/Tests/Persistence/Query_testcase.php
deleted file mode 100644 (file)
index 8dae9af..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2009 Christopher Hlubek <hlubek@networkteam.com>
-*  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!
-***************************************************************/
-
-class Tx_Extbase_Persistence_Query_testcase extends Tx_Extbase_Base_testcase {
-
-       public function setUp() {
-               $dataBase = $this->getMock('t3lib_DB', array('fullQuoteStr'));
-               $dataBase->expects($this->any())->method('fullQuoteStr')->will($this->returnValue($this->returnArgument(0)));
-               $GLOBALS['TSFE'] = $this->getMock('tslib_fe', array('includeTCA'), array(), '', FALSE);
-               $GLOBALS['TSFE']->expects($this->any())
-                       ->method('includeTCA')
-                       ->will($this->returnValue(NULL));               
-               $this->dataMapper = $this->getMock('Tx_Extbase_Persistence_Mapper_ObjectRelationalMapper', array(), array($dataBase));
-               $this->query = new Tx_Extbase_Persistence_Query('Tx_MyExtension_Domain_Model_Class');
-               $this->query->injectPersistenceBackend($dataBase);
-               $this->query->injectDataMapper($this->dataMapper);
-       }
-
-       public function test_queryObjectImplementsQueryInterface() {
-               $query = clone($this->query);
-               
-               $this->assertTrue($query instanceof Tx_Extbase_Persistence_QueryInterface);
-       }
-       
-       // public function test_generateWhereClauseWithRawStatement() {
-       //      $query = $this->getMock($this->buildAccessibleProxy(('Tx_Extbase_Persistence_Query'), array(), array('Tx_MyExtension_Domain_Model_Class')));
-       //      $constraint = $this->getMock('Tx_Extbase_Persistence_RawSqlConstraint', array('dummy'), array("SELECT * FROM tx_myextension_domain_model_class WHERE foo='bar'"));
-       //      $query->matching($constraint);
-       //      
-       //      $this->assertEquals($constraint, $query->_get('constraint'));
-       // }
-       // 
-       // public function test_generateWhereClauseWithPlaceholders() {
-       //      $query = clone($this->query);
-       //      
-       //      $dataMap = $this->getMock('Tx_Extbase_Persistence_Mapper_DataMap', array('convertPropertyValueToFieldValue'), array('Tx_MyExtension_Domain_Model_Class'));
-       //      $dataMap->expects($this->any())
-       //              ->method('convertPropertyValueToFieldValue')
-       //              ->will($this->returnCallback(array($this, 'convertPropertyValueToFieldValue')));
-       //      $whereClause = $query->generateWhereClause($dataMap,
-       //              array(
-       //                      array('name LIKE ? OR name LIKE ?', 'foo', 'bar'),
-       //                      array('hidden = ?', FALSE)
-       //                      )
-       //              );
-       //      
-       //      $this->assertEquals("(name LIKE 'foo' OR name LIKE 'bar') AND (hidden = 0)", $whereClause);
-       // }
-       // 
-       // public function test_generateWhereClauseWithExample() {
-       //      $query = clone($this->query);
-       //      $dataMap = $this->getMock('Tx_Extbase_Persistence_Mapper_DataMap', array('convertPropertyValueToFieldValue', 'getColumnMap'), array('Tx_MyExtension_Domain_Model_Class'));
-       //      $dataMap->expects($this->any())
-       //              ->method('convertPropertyValueToFieldValue')
-       //              ->will($this->returnCallback(array($this, 'convertPropertyValueToFieldValue')));                
-       //      $dataMap->expects($this->any())
-       //              ->method('getColumnMap')
-       //              ->withAnyParameters()
-       //              ->will($this->returnCallback(array($this, 'getColumnMap')));
-       //      $whereClause = $query->generateWhereClause($dataMap,
-       //              array(
-       //                      'name' => 'foo',
-       //                      'hidden' => FALSE
-       //                      )
-       //              );
-       //      
-       //      $this->assertEquals("(tx_myextension_domain_model_class.name = 'foo') AND (tx_myextension_domain_model_class.hidden = 0)", $whereClause);
-       // }
-       // 
-       // public function test_generateWhereClauseWithNestedExample() {
-       //      $query = clone($this->query);
-       //      $dataMap = $this->getMock('Tx_Extbase_Persistence_Mapper_DataMap', array('convertPropertyValueToFieldValue', 'getColumnMap'), array('Tx_MyExtension_Domain_Model_Class'));
-       //      $dataMap->expects($this->any())
-       //              ->method('convertPropertyValueToFieldValue')
-       //              ->will($this->returnCallback(array($this, 'convertPropertyValueToFieldValue')));                
-       //      $dataMap->expects($this->any())
-       //              ->method('getColumnMap')
-       //              ->withAnyParameters()
-       //              ->will($this->returnCallback(array($this, 'getColumnMap')));
-       //      $whereClause = $query->generateWhereClause($dataMap,
-       //              array(
-       //                      'name' => 'foo',
-       //                      'hidden' => FALSE
-       //                      )
-       //              );
-       //      $whereClause = $query->generateWhereClause($dataMap,
-       //              array(
-       //                      'hidden' => FALSE,
-       //                      'posts' => array(
-       //                              'title' => 'foo'
-       //                      )
-       //              ));
-       //      
-       //      $this->assertEquals("(tx_blogexample_domain_model_blog.hidden = 0) AND ((tx_blogexample_domain_model_post.title = 'foo'))", $whereClause);
-       // }
-       // 
-       // public function convertPropertyValueToFieldValue($propertyValue) {
-       //      if ($propertyValue === TRUE) return 1;
-       //      if ($propertyValue === FALSE) return 0;
-       //      return $GLOBALS['TYPO3_DB']->fullQuoteStr((string)$propertyValue, '');
-       // }
-       // 
-       // public function getColumnMap($propertyName) {
-       //      $columnMap = $this->getMock('Tx_Extbase_Persistence_Mapper_ColumnMap', array('getColumnName'), array($propertyName));
-       //      if ($propertyName === 'name') {
-       //              $columnMap->expects($this->any())
-       //                      ->method('getColumnName')
-       //                      ->will($this->returnValue('name'));
-       //      } elseif ($propertyName === 'hidden') {
-       //              $columnMap->expects($this->any())
-       //                      ->method('getColumnName')
-       //                      ->will($this->returnValue('hidden'));
-       //      }
-       //      return $columnMap;
-       // }
-       //      
-}
-
-?>
\ No newline at end of file