1
0
mirror of synced 2025-01-18 22:41:43 +03:00
This commit is contained in:
zYne 2007-07-05 22:53:51 +00:00
parent ec39adcd73
commit 65f0cb8d27
3 changed files with 17 additions and 23 deletions

View File

@ -412,10 +412,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
*/
public function hydrate(array $data)
{
foreach ($data as $k => $v) {
$this->_data[$k] = $v;
}
$this->_data = $this->_filter->cleanData($this->_data);
$this->_data = $this->_filter->cleanData($data);
$this->prepareIdentifiers(true);
}
/**

View File

@ -80,22 +80,19 @@ class Doctrine_Export_Pgsql_TestCase extends Doctrine_UnitTestCase
public function testExportSql()
{
$sql = $this->export->exportSql(dirname(__FILE__) . DIRECTORY_SEPARATOR . '_files');
$this->assertEqual($sql, array ( 0 => 'CREATE TABLE foo (id BIGSERIAL, name VARCHAR(200) NOT NULL, parent_id BIGINT, local_foo BIGINT, PRIMARY KEY(id))',
1 => 'CREATE TABLE foo_reference (foo1 BIGINT, foo2 BIGINT, PRIMARY KEY(foo1, foo2))',
2 => 'CREATE TABLE foo_bar_record (fooid BIGINT, barid BIGINT, PRIMARY KEY(fooid, barid))',
3 => 'CREATE TABLE bar (id BIGSERIAL, name VARCHAR(200), PRIMARY KEY(id))',
4 => 'CREATE TABLE foo_locally_owned (id BIGSERIAL, name VARCHAR(200), PRIMARY KEY(id))',
5 => 'CREATE TABLE foo_foreignly_owned (id BIGSERIAL, name VARCHAR(200), fooid BIGINT, PRIMARY KEY(id))',
6 => 'CREATE TABLE foo_foreignly_owned_with_pk (id BIGSERIAL, name VARCHAR(200), PRIMARY KEY(id))',
7 => 'ALTER TABLE foo_reference ADD CONSTRAINT FOREIGN KEY (foo1) REFERENCES foo(id) ON DELETE CASCADE',
8 => 'ALTER TABLE foo_reference ADD CONSTRAINT FOREIGN KEY (foo2) REFERENCES foo(id) ON DELETE CASCADE',
9 => 'ALTER TABLE foo ADD CONSTRAINT FOREIGN KEY (parent_id) REFERENCES foo(id) ON DELETE CASCADE',
10 => 'ALTER TABLE foo_foreignly_owned_with_pk ADD CONSTRAINT FOREIGN KEY (id) REFERENCES foo(id)',
11 => 'ALTER TABLE foo_bar_record ADD CONSTRAINT FOREIGN KEY (fooId) REFERENCES foo(id)',
12 => 'ALTER TABLE foo_bar_record ADD CONSTRAINT FOREIGN KEY (barId) REFERENCES bar(id)',
13 => 'ALTER TABLE foo_bar_record ADD CONSTRAINT FOREIGN KEY (barId) REFERENCES bar(id)',
14 => 'ALTER TABLE foo_bar_record ADD CONSTRAINT FOREIGN KEY (fooId) REFERENCES foo(id)', ));
$this->assertEqual($sql, array ( 0 => 'CREATE TABLE foo_reference (foo1 BIGINT, foo2 BIGINT, PRIMARY KEY(foo1, foo2))',
1 => 'CREATE TABLE foo_locally_owned (id BIGSERIAL, name VARCHAR(200), PRIMARY KEY(id))',
2 => 'CREATE TABLE foo_foreignly_owned_with_pk (id BIGSERIAL, name VARCHAR(200), PRIMARY KEY(id))',
3 => 'CREATE TABLE foo_foreignly_owned (id BIGSERIAL, name VARCHAR(200), fooid BIGINT, PRIMARY KEY(id))',
4 => 'CREATE TABLE foo_bar_record (fooid BIGINT, barid BIGINT, PRIMARY KEY(fooid, barid))',
5 => 'CREATE TABLE foo (id BIGSERIAL, name VARCHAR(200) NOT NULL, parent_id BIGINT, local_foo BIGINT, PRIMARY KEY(id))',
6 => 'CREATE TABLE bar (id BIGSERIAL, name VARCHAR(200), PRIMARY KEY(id))',
7 => 'ALTER TABLE foo_reference ADD CONSTRAINT FOREIGN KEY (foo1) REFERENCES foo(foo1, foo2) NOT DEFERRABLE INITIALLY IMMEDIATE',
8 => 'ALTER TABLE foo_bar_record ADD CONSTRAINT FOREIGN KEY (fooId) REFERENCES foo(fooid, barid) NOT DEFERRABLE INITIALLY IMMEDIATE',
9 => 'ALTER TABLE foo ADD CONSTRAINT FOREIGN KEY (parent_id) REFERENCES foo(id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE',
10 => 'ALTER TABLE foo ADD CONSTRAINT FOREIGN KEY (local_foo) REFERENCES foo_locally_owned(id) ON DELETE RESTRICT NOT DEFERRABLE INITIALLY IMMEDIATE',
));
}
}
?>

View File

@ -40,7 +40,7 @@ class Doctrine_Sequence_Mssql_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($this->adapter->pop(), 'SELECT @@IDENTITY');
$this->assertEqual($this->adapter->pop(), 'SELECT @@VERSION');
$this->assertEqual($this->adapter->pop(), 'SET IDENTITY_INSERT user_seq ON INSERT INTO user_seq (id) DEFAULT VALUES');
$this->assertEqual($this->adapter->pop(), 'SET IDENTITY_INSERT user_seq OFF INSERT INTO user_seq DEFAULT VALUES');
$this->assertEqual($this->adapter->pop(), 'SELECT COUNT(1) FROM user_seq');
}
public function testNextIdExecutesSql()
@ -50,8 +50,8 @@ class Doctrine_Sequence_Mssql_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($this->adapter->pop(), 'DELETE FROM user_seq WHERE id < 0');
$this->assertEqual($this->adapter->pop(), 'SELECT @@IDENTITY');
$this->assertEqual($this->adapter->pop(), 'SELECT @@VERSION');
$this->assertEqual($this->adapter->pop(), 'SET IDENTITY_INSERT user_seq ON INSERT INTO user_seq (id) DEFAULT VALUES');
$this->assertEqual($this->adapter->pop(), 'SELECT @@VERSION');
$this->assertEqual($this->adapter->pop(), 'SET IDENTITY_INSERT user_seq OFF INSERT INTO user_seq DEFAULT VALUES');
$this->assertEqual($this->adapter->pop(), 'SELECT COUNT(1) FROM user_seq');
}
public function testLastInsertIdCallsPdoLevelEquivalent()