Commit dfd15a60 authored by romanb's avatar romanb

Introduced ATTR_TBLNAME_FORMAT. Closes #257

parent b0c7dce4
......@@ -160,6 +160,7 @@ final class Doctrine
const ATTR_CMPNAME_FORMAT = 118;
const ATTR_DBNAME_FORMAT = 117;
const ATTR_TBLCLASS_FORMAT = 119;
const ATTR_TBLNAME_FORMAT = 120;
const ATTR_EXPORT = 140;
const ATTR_DECIMAL_PLACES = 141;
......
......@@ -226,4 +226,16 @@ class Doctrine_Formatter extends Doctrine_Connection_Module
return sprintf($this->conn->getAttribute(Doctrine::ATTR_IDXNAME_FORMAT),
preg_replace('/[^a-z0-9_\$]/i', '_', $idx));
}
/**
* adds table name formatting to a table name
*
* @param string name of the table
* @return string formatted table name
*/
public function getTableName($table)
{
return sprintf($this->conn->getAttribute(Doctrine::ATTR_TBLNAME_FORMAT),
preg_replace('/[^a-z0-9_\$]/i', '_', $table));
}
}
\ No newline at end of file
......@@ -99,6 +99,7 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
Doctrine::ATTR_QUERY_LIMIT => Doctrine::LIMIT_RECORDS,
Doctrine::ATTR_IDXNAME_FORMAT => "%s_idx",
Doctrine::ATTR_SEQNAME_FORMAT => "%s_seq",
Doctrine::ATTR_TBLNAME_FORMAT => "%s",
Doctrine::ATTR_QUOTE_IDENTIFIER => false,
Doctrine::ATTR_SEQCOL_NAME => 'id',
Doctrine::ATTR_PORTABILITY => Doctrine::PORTABILITY_ALL,
......
......@@ -97,7 +97,7 @@ abstract class Doctrine_Record_Abstract extends Doctrine_Access
}
public function setTableName($tableName)
{
$this->_table->setOption('tableName', $tableName);
$this->_table->setTableName($tableName);
}
public function setInheritanceMap($map)
{
......
......@@ -1467,7 +1467,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
*/
public function setTableName($tableName)
{
$this->_options['tableName'] = $tableName;
$this->setOption('tableName', $this->_conn->formatter->getTableName($tableName));
}
/**
......
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