From 0ef216a9b57936d82fff6af4fe779068f8dfe07a Mon Sep 17 00:00:00 2001 From: romanb Date: Fri, 12 Sep 2008 10:50:20 +0000 Subject: [PATCH] moved more files to TODO --- lib/Doctrine.php | 4 +- lib/Doctrine/Hook.php | 231 ----------------------- lib/Doctrine/{ => ORM/Export}/Export.php | 4 +- lib/Doctrine/{ => ORM/Import}/Import.php | 4 +- lib/Doctrine/{ => TODO}/File.php | 0 lib/Doctrine/{ => TODO}/FileFinder.php | 0 lib/Doctrine/{ => TODO}/Formatter.php | 0 lib/Doctrine/{ => TODO}/I18n.php | 0 lib/Doctrine/{ => TODO}/Inflector.php | 4 +- lib/Doctrine/{ => TODO}/Lib.php | 4 +- lib/Doctrine/{ => TODO}/Log.php | 0 lib/Doctrine/{ => TODO}/Migration.php | 0 lib/Doctrine/{ => TODO}/Node.php | 4 +- lib/Doctrine/{ => TODO}/Pager.php | 0 lib/Doctrine/{ => TODO}/Parser.php | 0 lib/Doctrine/{ => TODO}/Search.php | 0 lib/Doctrine/{ => TODO}/Task.php | 0 lib/Doctrine/{ => TODO}/Template.php | 0 lib/Doctrine/{ => TODO}/Tree.php | 4 +- lib/Doctrine/{ => TODO}/Util.php | 0 lib/Doctrine/{ => TODO}/Validator.php | 4 +- lib/Doctrine/{ => TODO}/View.php | 4 +- 22 files changed, 18 insertions(+), 249 deletions(-) delete mode 100644 lib/Doctrine/Hook.php rename lib/Doctrine/{ => ORM/Export}/Export.php (99%) rename lib/Doctrine/{ => ORM/Import}/Import.php (94%) rename lib/Doctrine/{ => TODO}/File.php (100%) rename lib/Doctrine/{ => TODO}/FileFinder.php (100%) rename lib/Doctrine/{ => TODO}/Formatter.php (100%) rename lib/Doctrine/{ => TODO}/I18n.php (100%) rename lib/Doctrine/{ => TODO}/Inflector.php (99%) rename lib/Doctrine/{ => TODO}/Lib.php (96%) rename lib/Doctrine/{ => TODO}/Log.php (100%) rename lib/Doctrine/{ => TODO}/Migration.php (100%) rename lib/Doctrine/{ => TODO}/Node.php (98%) rename lib/Doctrine/{ => TODO}/Pager.php (100%) rename lib/Doctrine/{ => TODO}/Parser.php (100%) rename lib/Doctrine/{ => TODO}/Search.php (100%) rename lib/Doctrine/{ => TODO}/Task.php (100%) rename lib/Doctrine/{ => TODO}/Template.php (100%) rename lib/Doctrine/{ => TODO}/Tree.php (97%) rename lib/Doctrine/{ => TODO}/Util.php (100%) rename lib/Doctrine/{ => TODO}/Validator.php (98%) rename lib/Doctrine/{ => TODO}/View.php (94%) diff --git a/lib/Doctrine.php b/lib/Doctrine.php index 515232c0f..83de5718e 100644 --- a/lib/Doctrine.php +++ b/lib/Doctrine.php @@ -1162,7 +1162,7 @@ final class Doctrine */ public static function tableize($className) { - return Doctrine_Inflector::tableize($className); + return Doctrine_TODO_Inflector::tableize($className); } /** @@ -1175,6 +1175,6 @@ final class Doctrine */ public static function classify($tableName) { - return Doctrine_Inflector::classify($tableName); + return Doctrine_TODO_Inflector::classify($tableName); } } \ No newline at end of file diff --git a/lib/Doctrine/Hook.php b/lib/Doctrine/Hook.php deleted file mode 100644 index 4fb44ec24..000000000 --- a/lib/Doctrine/Hook.php +++ /dev/null @@ -1,231 +0,0 @@ -. - */ - -/** - * Doctrine_Hook - * - * @package Doctrine - * @subpackage Hook - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - * @author Konsta Vesterinen - * @todo May be no longer useful and can be removed later. - */ -class Doctrine_Hook -{ - /** - * @var Doctrine_Query $query the base query - */ - protected $query; - - /** - * @var array $joins the optional joins of the base query - */ - protected $joins; - - /** - * @var array $hooks hooks array - */ - protected $hooks = array( - 'where', - 'orderby', - 'limit', - 'offset' - ); - - /** - * @var array $fieldParsers custom field parsers array - * keys as field names in the format componentAlias.FieldName - * values as parser names / objects - */ - protected $fieldParsers = array(); - - /** - * @var array $typeParsers type parsers array - * keys as type names and values as parser names / objects - */ - protected $typeParsers = array( - 'char' => 'Doctrine_Hook_WordLike', - 'string' => 'Doctrine_Hook_WordLike', - 'varchar' => 'Doctrine_Hook_WordLike', - 'integer' => 'Doctrine_Hook_Integer', - 'enum' => 'Doctrine_Hook_Integer', - 'time' => 'Doctrine_Hook_Time', - 'date' => 'Doctrine_Hook_Date', - ); - - /** - * @param Doctrine_Query $query the base query - */ - public function __construct($query) - { - if (is_string($query)) { - $this->query = new Doctrine_Query(); - $this->query->parseQuery($query); - } elseif ($query instanceof Doctrine_Query) { - $this->query = $query; - } else { - throw new Doctrine_Exception('Constructor argument should be either Doctrine_Query object or valid DQL query'); - } - - $this->query->getQuery(); - } - - /** - * getQuery - * - * @return Doctrine_Query returns the query object associated with this hook - */ - public function getQuery() - { - return $this->query; - } - - /** - * setTypeParser - * - * @param string $type type name - * @param string|object $parser parser name or custom parser object - */ - public function setTypeParser($type, $parser) - { - $this->typeParsers[$type] = $parser; - } - - /** - * setFieldParser - * - * @param string $field field name - * @param string|object $parser parser name or custom parser object - */ - public function setFieldParser($field, $parser) - { - $this->fieldParsers[$field] = $parser; - } - - /** - * hookWhere - * builds DQL query where part from given parameter array - * - * @param array $params an associative array containing field - * names and their values - * @return boolean whether or not the hooking was - */ - public function hookWhere($params) - { - if ( ! is_array($params)) { - return false; - } - foreach ($params as $name => $value) { - if ($value === '' || $value === '-') { - continue; - } - $e = explode('.', $name); - - if (count($e) == 2) { - list($alias, $column) = $e; - - $map = $this->query->getAliasDeclaration($alias); - $table = $map['table']; - - if ( ! $table) { - throw new Doctrine_Exception('Unknown alias ' . $alias); - } - - if ($def = $table->getDefinitionOf($column)) { - - $def[0] = gettype($value); - if (isset($this->typeParsers[$def[0]])) { - $name = $this->typeParsers[$def[0]]; - $parser = new $name; - } - - $parser->parse($alias, $column, $value); - - $this->query->addWhere($parser->getCondition(), $parser->getParams()); - } - } - } - - return true; - } - - /** - * hookOrderBy - * builds DQL query orderby part from given parameter array - * - * @param array $params an array containing all fields which the built query - * should be ordered by - * @return boolean whether or not the hooking was successful - */ - public function hookOrderby($params) - { - if ( ! is_array($params)) { - return false; - } - foreach ($params as $name) { - $e = explode(' ', $name); - - $order = 'ASC'; - - if (count($e) > 1) { - $order = ($e[1] == 'DESC') ? 'DESC' : 'ASC'; - } - - $e = explode('.', $e[0]); - - if (count($e) == 2) { - list($alias, $column) = $e; - - $map = $this->query->getAliasDeclaration($alias); - $table = $map['table']; - - if ($def = $table->getDefinitionOf($column)) { - $this->query->addOrderBy($alias . '.' . $column . ' ' . $order); - } - } - } - return true; - } - - /** - * set the hook limit - * - * @param integer $limit - * @return void - */ - public function hookLimit($limit) - { - $this->query->limit((int) $limit); - } - - /** - * set the hook offset - * - * @param integer $offset - */ - public function hookOffset($offset) - { - $this->query->offset((int) $offset); - } -} diff --git a/lib/Doctrine/Export.php b/lib/Doctrine/ORM/Export/Export.php similarity index 99% rename from lib/Doctrine/Export.php rename to lib/Doctrine/ORM/Export/Export.php index 0a5fe7a17..b93c0a7a9 100644 --- a/lib/Doctrine/Export.php +++ b/lib/Doctrine/ORM/Export/Export.php @@ -1,6 +1,6 @@ * @author Jukka Hassinen */ diff --git a/lib/Doctrine/File.php b/lib/Doctrine/TODO/File.php similarity index 100% rename from lib/Doctrine/File.php rename to lib/Doctrine/TODO/File.php diff --git a/lib/Doctrine/FileFinder.php b/lib/Doctrine/TODO/FileFinder.php similarity index 100% rename from lib/Doctrine/FileFinder.php rename to lib/Doctrine/TODO/FileFinder.php diff --git a/lib/Doctrine/Formatter.php b/lib/Doctrine/TODO/Formatter.php similarity index 100% rename from lib/Doctrine/Formatter.php rename to lib/Doctrine/TODO/Formatter.php diff --git a/lib/Doctrine/I18n.php b/lib/Doctrine/TODO/I18n.php similarity index 100% rename from lib/Doctrine/I18n.php rename to lib/Doctrine/TODO/I18n.php diff --git a/lib/Doctrine/Inflector.php b/lib/Doctrine/TODO/Inflector.php similarity index 99% rename from lib/Doctrine/Inflector.php rename to lib/Doctrine/TODO/Inflector.php index 15c8ed72b..f9e30ef54 100644 --- a/lib/Doctrine/Inflector.php +++ b/lib/Doctrine/TODO/Inflector.php @@ -36,7 +36,7 @@ * @version $Revision: 3189 $ * @author Konsta Vesterinen */ -class Doctrine_Inflector +class Doctrine_TODO_Inflector { /** * pluralize @@ -207,7 +207,7 @@ class Doctrine_Inflector */ public static function classify($word) { - return preg_replace_callback('~(_?)(_)([\w])~', array("Doctrine_Inflector", "classifyCallback"), ucfirst(strtolower($word))); + return preg_replace_callback('~(_?)(_)([\w])~', array("Doctrine_TODO_Inflector", "classifyCallback"), ucfirst(strtolower($word))); } /** diff --git a/lib/Doctrine/Lib.php b/lib/Doctrine/TODO/Lib.php similarity index 96% rename from lib/Doctrine/Lib.php rename to lib/Doctrine/TODO/Lib.php index c1ae1cf7e..db8010818 100644 --- a/lib/Doctrine/Lib.php +++ b/lib/Doctrine/TODO/Lib.php @@ -1,6 +1,6 @@ * @todo Split into DBAL/ORM parts. DBAL class goes into Doctrine::DBAL::Tools */ diff --git a/lib/Doctrine/Log.php b/lib/Doctrine/TODO/Log.php similarity index 100% rename from lib/Doctrine/Log.php rename to lib/Doctrine/TODO/Log.php diff --git a/lib/Doctrine/Migration.php b/lib/Doctrine/TODO/Migration.php similarity index 100% rename from lib/Doctrine/Migration.php rename to lib/Doctrine/TODO/Migration.php diff --git a/lib/Doctrine/Node.php b/lib/Doctrine/TODO/Node.php similarity index 98% rename from lib/Doctrine/Node.php rename to lib/Doctrine/TODO/Node.php index f1dd261ae..c3b555a0d 100644 --- a/lib/Doctrine/Node.php +++ b/lib/Doctrine/TODO/Node.php @@ -1,6 +1,6 @@ */ class Doctrine_Node implements IteratorAggregate diff --git a/lib/Doctrine/Pager.php b/lib/Doctrine/TODO/Pager.php similarity index 100% rename from lib/Doctrine/Pager.php rename to lib/Doctrine/TODO/Pager.php diff --git a/lib/Doctrine/Parser.php b/lib/Doctrine/TODO/Parser.php similarity index 100% rename from lib/Doctrine/Parser.php rename to lib/Doctrine/TODO/Parser.php diff --git a/lib/Doctrine/Search.php b/lib/Doctrine/TODO/Search.php similarity index 100% rename from lib/Doctrine/Search.php rename to lib/Doctrine/TODO/Search.php diff --git a/lib/Doctrine/Task.php b/lib/Doctrine/TODO/Task.php similarity index 100% rename from lib/Doctrine/Task.php rename to lib/Doctrine/TODO/Task.php diff --git a/lib/Doctrine/Template.php b/lib/Doctrine/TODO/Template.php similarity index 100% rename from lib/Doctrine/Template.php rename to lib/Doctrine/TODO/Template.php diff --git a/lib/Doctrine/Tree.php b/lib/Doctrine/TODO/Tree.php similarity index 97% rename from lib/Doctrine/Tree.php rename to lib/Doctrine/TODO/Tree.php index 73b51378f..a4f8baeb9 100644 --- a/lib/Doctrine/Tree.php +++ b/lib/Doctrine/TODO/Tree.php @@ -1,6 +1,6 @@ * @todo Move to NestedSet behavior. */ diff --git a/lib/Doctrine/Util.php b/lib/Doctrine/TODO/Util.php similarity index 100% rename from lib/Doctrine/Util.php rename to lib/Doctrine/TODO/Util.php diff --git a/lib/Doctrine/Validator.php b/lib/Doctrine/TODO/Validator.php similarity index 98% rename from lib/Doctrine/Validator.php rename to lib/Doctrine/TODO/Validator.php index 702e649a0..105aea27a 100644 --- a/lib/Doctrine/Validator.php +++ b/lib/Doctrine/TODO/Validator.php @@ -1,6 +1,6 @@ * @author Konsta Vesterinen * @todo Move to validator package. diff --git a/lib/Doctrine/View.php b/lib/Doctrine/TODO/View.php similarity index 94% rename from lib/Doctrine/View.php rename to lib/Doctrine/TODO/View.php index e59217d5b..76b87047f 100644 --- a/lib/Doctrine/View.php +++ b/lib/Doctrine/TODO/View.php @@ -1,6 +1,6 @@