1
0
mirror of synced 2024-12-13 14:56:01 +03:00
This commit is contained in:
Jonathan.Wage 2007-11-27 03:36:40 +00:00
parent 7389d82834
commit 562a48769c
4 changed files with 19 additions and 4 deletions

View File

@ -175,12 +175,22 @@ class Doctrine_Import_Pgsql extends Doctrine_Import
'length' => $decl['length'],
'fixed' => $decl['fixed'],
'unsigned' => $decl['unsigned'],
'notnull' => ($val['isnotnull'] == ''),
'notnull' => ($val['isnotnull'] == true),
'default' => $val['default'],
'primary' => ($val['pri'] == 't'),
);
$matches = array();
if (preg_match("/^nextval\('(.*)'(::.*)?\)$/", $description['default'], $matches)) {
$description['sequence'] = $this->conn->formatter->fixSequenceName($matches[1]);
$description['default'] = null;
}
$columns[$val['field']] = $description;
}
return $columns;
}

View File

@ -332,6 +332,7 @@ class Doctrine_Import_Schema
$colDesc['default'] = isset($field['default']) ? $field['default']:null;
$colDesc['autoincrement'] = isset($field['autoincrement']) ? (bool) (isset($field['autoincrement']) && $field['autoincrement']):null;
$colDesc['autoincrement'] = isset($field['autoinc']) ? (bool) (isset($field['autoinc']) && $field['autoinc']):$colDesc['autoincrement'];
$colDesc['sequence'] = isset($field['sequence']) ? (string) $field['sequence']:null;
$colDesc['values'] = isset($field['values']) ? (array) $field['values']:null;
$validators = Doctrine::getValidators();

View File

@ -1294,8 +1294,12 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
*
* @return Doctrine_Record
*/
public function copy()
public function copy($deep = false)
{
if ($deep) {
return $this->copyDeep();
}
$data = $this->_data;
if ($this->_table->getIdentifierType() === Doctrine::IDENTIFIER_AUTOINC) {

View File

@ -293,7 +293,6 @@ abstract class Doctrine_Record_Abstract extends Doctrine_Access
*/
public function actAs($tpl, array $options = array())
{
if ( ! is_object($tpl)) {
if (class_exists($tpl, true)) {
$tpl = new $tpl($options);
@ -312,8 +311,9 @@ abstract class Doctrine_Record_Abstract extends Doctrine_Access
if ( ! ($tpl instanceof Doctrine_Template)) {
throw new Doctrine_Record_Exception('Loaded plugin class is not an istance of Doctrine_Template.');
}
$className = get_class($tpl);
$this->_table->addTemplate($className, $tpl);
$tpl->setTable($this->_table);