Permalink
Browse files

Move BasePeer constants to TableMap

  • Loading branch information...
1 parent 6bf63ab commit 7179b6db633718d1c0d3a136d7162369de6d8ac4 @willdurand willdurand committed Jul 31, 2012
@@ -271,7 +271,8 @@ protected function addClassBody(&$script)
'\Propel\Runtime\ActiveRecord\ActiveRecordInterface',
'\Propel\Runtime\Parser\AbstractParser',
'\Propel\Runtime\Propel',
- '\Propel\Runtime\Util\BasePeer'
+ '\Propel\Runtime\Util\BasePeer',
+ '\Propel\Runtime\Map\TableMap'
);
$table = $this->getTable();
@@ -2247,9 +2248,9 @@ protected function addToArray(&$script)
* You can specify the key type of the array by passing one of the class
* type constants.
*
- * @param string \$keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
- * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
- * Defaults to BasePeer::$defaultKeyType.
+ * @param string \$keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME,
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::$defaultKeyType.
* @param boolean \$includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
* @param array \$alreadyDumpedObjects List of objects to skip to avoid recursion";
if ($hasFks) {
@@ -2260,7 +2261,7 @@ protected function addToArray(&$script)
*
* @return array an associative array containing the field names (as keys) and field values
*/
- public function toArray(\$keyType = BasePeer::$defaultKeyType, \$includeLazyLoadColumns = true, \$alreadyDumpedObjects = array()" . ($hasFks ? ", \$includeForeignObjects = false" : '') . ")
+ public function toArray(\$keyType = TableMap::$defaultKeyType, \$includeLazyLoadColumns = true, \$alreadyDumpedObjects = array()" . ($hasFks ? ", \$includeForeignObjects = false" : '') . ")
{
if (isset(\$alreadyDumpedObjects['$objectClassName'][$pkGetter])) {
return '*RECURSION*';
@@ -2337,9 +2338,9 @@ protected function addGetByNameComment(&$script)
*
* @param string \$name name
* @param string \$type The type of fieldname the \$name is of:
- * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
- * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
- * Defaults to BasePeer::$defaultKeyType.
+ * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::$defaultKeyType.
* @return mixed Value of field.
*/";
}
@@ -2353,7 +2354,7 @@ protected function addGetByNameOpen(&$script)
{
$defaultKeyType = $this->getDefaultKeyType();
$script .= "
- public function getByName(\$name, \$type = BasePeer::$defaultKeyType)
+ public function getByName(\$name, \$type = TableMap::$defaultKeyType)
{";
}
@@ -2365,7 +2366,7 @@ public function getByName(\$name, \$type = BasePeer::$defaultKeyType)
protected function addGetByNameBody(&$script)
{
$script .= "
- \$pos = ".$this->getPeerClassName()."::translateFieldName(\$name, \$type, BasePeer::TYPE_NUM);
+ \$pos = ".$this->getPeerClassName()."::translateFieldName(\$name, \$type, TableMap::TYPE_NUM);
\$field = \$this->getByPosition(\$pos);";
}
@@ -2472,14 +2473,14 @@ protected function addSetByName(&$script)
* @param string \$name peer name
* @param mixed \$value field value
* @param string \$type The type of fieldname the \$name is of:
- * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
- * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
- * Defaults to BasePeer::$defaultKeyType.
+ * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::$defaultKeyType.
* @return void
*/
- public function setByName(\$name, \$value, \$type = BasePeer::$defaultKeyType)
+ public function setByName(\$name, \$value, \$type = TableMap::$defaultKeyType)
{
- \$pos = ".$this->getPeerClassName()."::translateFieldName(\$name, \$type, BasePeer::TYPE_NUM);
+ \$pos = ".$this->getPeerClassName()."::translateFieldName(\$name, \$type, TableMap::TYPE_NUM);
return \$this->setByPosition(\$pos, \$value);
}
@@ -2547,15 +2548,15 @@ protected function addFromArray(&$script)
* array. If so the setByName() method is called for that column.
*
* You can specify the key type of the array by additionally passing one
- * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
- * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
- * The default key type is the column's BasePeer::$defaultKeyType.
+ * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME,
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * The default key type is the column's TableMap::$defaultKeyType.
*
* @param array \$arr An array to populate the object from.
* @param string \$keyType The type of keys the array uses.
* @return void
*/
- public function fromArray(\$arr, \$keyType = BasePeer::$defaultKeyType)
+ public function fromArray(\$arr, \$keyType = TableMap::$defaultKeyType)
{
\$keys = ".$this->getPeerClassName()."::getFieldNames(\$keyType);
";
@@ -144,6 +144,7 @@ protected function addClassBody(&$script)
'\Propel\Runtime\Connection\StatementInterface',
'\Propel\Runtime\Exception\PropelException',
'\Propel\Runtime\Util\BasePeer',
+ '\Propel\Runtime\Map\TableMap',
'\Propel\Runtime\ActiveQuery\Criteria',
'\PDO'
);
@@ -324,32 +325,32 @@ protected function addFieldNamesAttribute(&$script)
* e.g. self::\$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static \$fieldNames = array (
- BasePeer::TYPE_PHPNAME => array (";
+ TableMap::TYPE_PHPNAME => array (";
foreach ($tableColumns as $col) {
$script .= "'".$col->getPhpName()."', ";
}
$script .= "),
- BasePeer::TYPE_STUDLYPHPNAME => array (";
+ TableMap::TYPE_STUDLYPHPNAME => array (";
foreach ($tableColumns as $col) {
$script .= "'".$col->getStudlyPhpName()."', ";
}
$script .= "),
- BasePeer::TYPE_COLNAME => array (";
+ TableMap::TYPE_COLNAME => array (";
foreach ($tableColumns as $col) {
$script .= $this->getColumnConstant($col, 'self').", ";
}
$script .= "),
- BasePeer::TYPE_RAW_COLNAME => array (";
+ TableMap::TYPE_RAW_COLNAME => array (";
foreach ($tableColumns as $col) {
$script .= "'" . $col->getConstantColumnName() . "', ";
}
$script .= "),
- BasePeer::TYPE_FIELDNAME => array (";
+ TableMap::TYPE_FIELDNAME => array (";
foreach ($tableColumns as $col) {
$script .= "'".$col->getName()."', ";
}
$script .= "),
- BasePeer::TYPE_NUM => array (";
+ TableMap::TYPE_NUM => array (";
foreach ($tableColumns as $num => $col) {
$script .= "$num, ";
}
@@ -372,35 +373,35 @@ protected function addFieldKeysAttribute(&$script)
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
- * e.g. self::\$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ * e.g. self::\$fieldNames[TableMap::TYPE_PHPNAME]['Id'] = 0
*/
protected static \$fieldKeys = array (
- BasePeer::TYPE_PHPNAME => array (";
+ TableMap::TYPE_PHPNAME => array (";
foreach ($tableColumns as $num => $col) {
$script .= "'".$col->getPhpName()."' => $num, ";
}
$script .= "),
- BasePeer::TYPE_STUDLYPHPNAME => array (";
+ TableMap::TYPE_STUDLYPHPNAME => array (";
foreach ($tableColumns as $num => $col) {
$script .= "'".$col->getStudlyPhpName()."' => $num, ";
}
$script .= "),
- BasePeer::TYPE_COLNAME => array (";
+ TableMap::TYPE_COLNAME => array (";
foreach ($tableColumns as $num => $col) {
$script .= $this->getColumnConstant($col, 'self')." => $num, ";
}
$script .= "),
- BasePeer::TYPE_RAW_COLNAME => array (";
+ TableMap::TYPE_RAW_COLNAME => array (";
foreach ($tableColumns as $num => $col) {
$script .= "'" . $col->getConstantColumnName() . "' => $num, ";
}
$script .= "),
- BasePeer::TYPE_FIELDNAME => array (";
+ TableMap::TYPE_FIELDNAME => array (";
foreach ($tableColumns as $num => $col) {
$script .= "'".$col->getName()."' => $num, ";
}
$script .= "),
- BasePeer::TYPE_NUM => array (";
+ TableMap::TYPE_NUM => array (";
foreach ($tableColumns as $num => $col) {
$script .= "$num, ";
}
@@ -445,15 +446,15 @@ protected function addGetFieldNames(&$script)
* Returns an array of field names.
*
* @param string \$type The type of fieldnames to return:
- * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
- * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
* @return array A list of field names
* @throws PropelException
*/
- public static function getFieldNames(\$type = BasePeer::TYPE_PHPNAME)
+ public static function getFieldNames(\$type = TableMap::TYPE_PHPNAME)
{
if (!array_key_exists(\$type, self::\$fieldNames)) {
- throw new PropelException('Method getFieldNames() expects the parameter \$type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . \$type . ' was given.');
+ throw new PropelException('Method getFieldNames() expects the parameter \$type to be one of the class constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME, TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. ' . \$type . ' was given.');
}
return self::\$fieldNames[\$type];
@@ -472,8 +473,8 @@ protected function addTranslateFieldName(&$script)
* Translates a fieldname to another type
*
* @param string \$name field name
- * @param string \$fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
- * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string \$fromType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
* @param string \$toType One of the class type constants
* @return string translated name of the field.
* @throws PropelException - if the specified name could not be found in the fieldname mappings.
@@ -12,7 +12,7 @@ public function isModified()
/**
* Has specified column been modified?
*
- * @param string $col column fully qualified name (BasePeer::TYPE_COLNAME), e.g. Book::AUTHOR_ID
+ * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID
* @return boolean True if $col has been modified.
*/
public function isColumnModified($col)
@@ -212,7 +212,7 @@ public function importFrom($parser, $data)
$parser = AbstractParser::getParser($parser);
}
- return $this->fromArray($parser->toArray($data), BasePeer::TYPE_PHPNAME);
+ return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME);
}
/**
@@ -233,7 +233,7 @@ public function exportTo($parser, $includeLazyLoadColumns = true)
$parser = AbstractParser::getParser($parser);
}
- return $parser->fromArray($this->toArray(BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true));
+ return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true));
}
/**
@@ -546,7 +546,7 @@ public function select($columnArray)
if ('*' === $columnArray) {
$columnArray = array();
- foreach (call_user_func(array($this->modelPeerName, 'getFieldNames'), BasePeer::TYPE_PHPNAME) as $column) {
+ foreach (call_user_func(array($this->modelPeerName, 'getFieldNames'), TableMap::TYPE_PHPNAME) as $column) {
$columnArray []= $this->modelName . '.' . $column;
}
}
@@ -1246,7 +1246,7 @@ public function findOneOrCreate($con = null)
$class = $this->getModelName();
$obj = new $class();
foreach ($this->keys() as $key) {
- $obj->setByName($key, $this->getValue($key), BasePeer::TYPE_COLNAME);
+ $obj->setByName($key, $this->getValue($key), TableMap::TYPE_COLNAME);
}
$ret = $this->getFormatter()->formatRecord($obj);
}
@@ -10,13 +10,13 @@
namespace Propel\Runtime\Adapter\Pdo;
+use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\Adapter\AdapterInterface;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Connection\StatementInterface;
use Propel\Runtime\Exception\InvalidArgumentException;
use Propel\Runtime\Map\ColumnMap;
use Propel\Runtime\Util\BasePeer;
-use Propel\Runtime\ActiveQuery\Criteria;
/**
* Oracle adapter.
@@ -18,9 +18,7 @@
use Propel\Runtime\Util\BasePeer;
/**
- * This is used to connect to PostgresQL databases.
- *
- * <a href="http://www.pgsql.org">http://www.pgsql.org</a>
+ * This is used to connect to PostgreSQL databases.
*
* @author Hans Lellelid <hans@xmpl.org> (Propel)
* @author Hakan Tandogan <hakan42@gmx.de> (Torque)
@@ -18,7 +18,7 @@
use Propel\Runtime\Exception\UnexpectedValueException;
use Propel\Runtime\Formatter\AbstractFormatter;
use Propel\Runtime\Parser\AbstractParser;
-use Propel\Runtime\Util\BasePeer;
+use Propel\Runtime\Map\TableMap;
/**
* Class for iterating over a list of Propel elements
@@ -531,7 +531,7 @@ public function importFrom($parser, $data)
$parser = AbstractParser::getParser($parser);
}
- return $this->fromArray($parser->listToArray($data), BasePeer::TYPE_PHPNAME);
+ return $this->fromArray($parser->listToArray($data), TableMap::TYPE_PHPNAME);
}
/**
@@ -560,7 +560,7 @@ public function exportTo($parser, $usePrefix = true, $includeLazyLoadColumns = t
$parser = AbstractParser::getParser($parser);
}
- return $parser->listFromArray($this->toArray(null, $usePrefix, BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns));
+ return $parser->listFromArray($this->toArray(null, $usePrefix, TableMap::TYPE_PHPNAME, $includeLazyLoadColumns));
}
/**
@@ -17,8 +17,8 @@
use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Exception\RuntimeException;
use Propel\Runtime\Map\RelationMap;
+use Propel\Runtime\Map\TableMap;
use Propel\Runtime\ActiveQuery\PropelQuery;
-use Propel\Runtime\Util\BasePeer;
/**
* Class for iterating over a list of Propel objects
@@ -124,9 +124,9 @@ public function fromArray($arr)
* Otherwise, the array is indexed using the specified column
* @param boolean $usePrefix If true, the returned array prefixes keys
* with the model class name ('Article_0', 'Article_1', etc).
- * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME,
- * BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME,
- * BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME.
+ * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME,
+ * TableMap::TYPE_STUDLYPHPNAME, TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME,
+ * TableMap::TYPE_NUM. Defaults to TableMap::TYPE_PHPNAME.
* @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
* @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
*
@@ -150,7 +150,7 @@ public function fromArray($arr)
*
* @return array
*/
- public function toArray($keyColumn = null, $usePrefix = false, $keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array())
+ public function toArray($keyColumn = null, $usePrefix = false, $keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array())
{
$ret = array();
$keyGetterMethod = 'get' . $keyColumn;
@@ -14,7 +14,7 @@
use Propel\Runtime\Connection\StatementInterface;
use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Formatter\AbstractFormatter;
-use Propel\Runtime\Util\BasePeer;
+use Propel\Runtime\Map\TableMap;
/**
* Class for iterating over a statement and returning one Propel object at a time
@@ -52,9 +52,9 @@ public function initIterator(AbstractFormatter $formatter, StatementInterface $s
* Otherwise, the array is indexed using the specified column
* @param boolean $usePrefix If true, the returned array prefixes keys
* with the model class name ('Article_0', 'Article_1', etc).
- * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME,
- * BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME,
- * BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME.
+ * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME,
+ * TableMap::TYPE_STUDLYPHPNAME, TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME,
+ * TableMap::TYPE_NUM. Defaults to TableMap::TYPE_PHPNAME.
* @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
* @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
*
@@ -78,7 +78,7 @@ public function initIterator(AbstractFormatter $formatter, StatementInterface $s
*
* @return array
*/
- public function toArray($keyColumn = null, $usePrefix = false, $keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array())
+ public function toArray($keyColumn = null, $usePrefix = false, $keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array())
{
$ret = array();
$keyGetterMethod = 'get' . $keyColumn;
Oops, something went wrong.

0 comments on commit 7179b6d

Please sign in to comment.