Commit 562a4876 authored by Jonathan.Wage's avatar Jonathan.Wage

fixes #568

parent 7389d828
......@@ -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;
}
......
......@@ -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();
......
......@@ -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) {
......
......@@ -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,6 +311,7 @@ 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);
......
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