Commit 0ef216a9 authored by romanb's avatar romanb

moved more files to TODO

parent 18ec38ee
......@@ -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
<?php
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
/**
* 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 <kvesteri@cc.hut.fi>
* @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);
}
}
<?php
/*
* $Id$
* $Id: Export.php 4805 2008-08-25 19:11:58Z subzero2000 $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
......@@ -31,7 +31,7 @@
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @version $Revision: 4805 $
* @todo Rename to ExportManager. Subclasses: MySqlExportManager, PgSqlExportManager etc.
*/
class Doctrine_Export extends Doctrine_Connection_Module
......
<?php
/*
* $Id$
* $Id: Import.php 4866 2008-08-31 18:27:16Z romanb $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
......@@ -32,7 +32,7 @@
* @link www.phpdoctrine.org
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @since 1.0
* @version $Revision$
* @version $Revision: 4866 $
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Jukka Hassinen <Jukka.Hassinen@BrainAlliance.com>
*/
......
......@@ -36,7 +36,7 @@
* @version $Revision: 3189 $
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
*/
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)));
}
/**
......
<?php
/*
* $Id$
* $Id: Lib.php 4523 2008-06-15 15:56:28Z romanb $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
......@@ -29,7 +29,7 @@
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @version $Revision: 4523 $
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @todo Split into DBAL/ORM parts. DBAL class goes into Doctrine::DBAL::Tools
*/
......
<?php
/*
* $Id$
* $Id: Node.php 4364 2008-05-13 21:20:34Z romanb $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
......@@ -27,7 +27,7 @@
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @version $Revision: 4364 $
* @author Joe Simms <joe.simms@websites4.com>
*/
class Doctrine_Node implements IteratorAggregate
......
<?php
/*
* $Id$
* $Id: Tree.php 4699 2008-07-20 20:13:24Z romanb $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
......@@ -26,7 +26,7 @@
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @version $Revision: 4699 $
* @author Joe Simms <joe.simms@websites4.com>
* @todo Move to NestedSet behavior.
*/
......
<?php
/*
* $Id$
* $Id: Validator.php 4699 2008-07-20 20:13:24Z romanb $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
......@@ -30,7 +30,7 @@
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @version $Revision: 4699 $
* @author Roman Borschel <roman@code-factory.org>
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @todo Move to validator package.
......
<?php
/*
* $Id$
* $Id: View.php 4456 2008-05-30 12:09:24Z romanb $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
......@@ -32,7 +32,7 @@
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @version $Revision: 4456 $
* @todo Maybe needs a reworked implementation and a new place.
*/
class Doctrine_View
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment