1
0
Fork 0
mirror of synced 2025-04-01 12:26:11 +03:00

Introduced ATTR_TBLNAME_FORMAT. Closes #257

This commit is contained in:
romanb 2007-10-30 13:30:50 +00:00
parent b0c7dce47f
commit dfd15a6068
5 changed files with 16 additions and 2 deletions

View file

@ -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;

View file

@ -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));
}
}

View 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,

View file

@ -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)
{

View file

@ -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));
}
/**