Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
1278934f
Commit
1278934f
authored
Sep 23, 2006
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed #108
Ticket: 108
parent
d94d5ec1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
8 deletions
+19
-8
Hydrate.php
Doctrine/Hydrate.php
+2
-2
RelationAccessTestCase.php
tests/RelationAccessTestCase.php
+15
-4
run.php
tests/run.php
+2
-2
No files found.
Doctrine/Hydrate.php
View file @
1278934f
...
@@ -381,6 +381,7 @@ abstract class Doctrine_Hydrate extends Doctrine_Access {
...
@@ -381,6 +381,7 @@ abstract class Doctrine_Hydrate extends Doctrine_Access {
$record
=
$this
->
tables
[
$name
]
->
getRecord
();
$record
=
$this
->
tables
[
$name
]
->
getRecord
();
if
(
$name
==
$root
)
{
if
(
$name
==
$root
)
{
// add record into root collection
// add record into root collection
$coll
->
add
(
$record
);
$coll
->
add
(
$record
);
unset
(
$previd
);
unset
(
$previd
);
...
@@ -400,8 +401,7 @@ abstract class Doctrine_Hydrate extends Doctrine_Access {
...
@@ -400,8 +401,7 @@ abstract class Doctrine_Hydrate extends Doctrine_Access {
case
Doctrine_Relation
::
ONE_AGGREGATE
:
case
Doctrine_Relation
::
ONE_AGGREGATE
:
// one-to-one relation
// one-to-one relation
$last
->
rawSet
(
$fk
->
getLocal
(),
$record
->
getIncremented
());
$last
->
internalSet
(
$fk
->
getLocal
(),
$record
->
getIncremented
());
$last
->
initSingleReference
(
$record
,
$fk
);
$last
->
initSingleReference
(
$record
,
$fk
);
...
...
tests/RelationAccessTestCase.php
View file @
1278934f
...
@@ -23,32 +23,42 @@ class Doctrine_RelationAccessTestCase extends Doctrine_UnitTestCase {
...
@@ -23,32 +23,42 @@ class Doctrine_RelationAccessTestCase extends Doctrine_UnitTestCase {
$this
->
tables
=
array
(
"File_Owner"
,
"Data_File"
);
$this
->
tables
=
array
(
"File_Owner"
,
"Data_File"
);
parent
::
prepareTables
();
parent
::
prepareTables
();
}
}
public
function
testOneToOneAggregateRelationFetching
()
{
$coll
=
$this
->
connection
->
query
(
"FROM File_Owner.Data_File WHERE File_Owner.name = 'owner1'"
);
$this
->
assertTrue
(
count
(
$coll
)
==
1
);
$this
->
assertTrue
(
$coll
[
0
]
instanceof
Doctrine_Record
);
$this
->
assertEqual
(
$coll
[
0
]
->
id
,
1
);
}
public
function
testAccessOneToOneFromForeignSide
()
{
public
function
testAccessOneToOneFromForeignSide
()
{
$check
=
$this
->
connection
->
query
(
"FROM File_Owner WHERE File_Owner.name = 'owner1'"
);
$check
=
$this
->
connection
->
query
(
"FROM File_Owner WHERE File_Owner.name = 'owner1'"
);
$owner1
=
$this
->
connection
->
query
(
"FROM File_Owner.Data_File WHERE File_Owner.name = 'owner1'"
);
$owner1
=
$this
->
connection
->
query
(
"FROM File_Owner.Data_File WHERE File_Owner.name = 'owner1'"
);
$owner2
=
$this
->
connection
->
query
(
"FROM File_Owner.Data_File WHERE File_Owner.name = 'owner2'"
);
$owner2
=
$this
->
connection
->
query
(
"FROM File_Owner.Data_File WHERE File_Owner.name = 'owner2'"
);
$this
->
assertTrue
(
count
(
$check
)
==
1
);
$this
->
assertTrue
(
count
(
$check
)
==
1
);
$this
->
assertTrue
(
count
(
$owner1
)
==
1
);
$this
->
assertTrue
(
count
(
$owner2
)
==
1
);
$this
->
assertTrue
(
count
(
$owner2
)
==
1
);
$check
=
$check
[
0
];
$check
=
$check
[
0
];
$owner1
=
$owner1
[
0
];
$owner1
=
$owner1
[
0
];
$owner2
=
$owner2
[
0
];
$owner2
=
$owner2
[
0
];
$this
->
assertEqual
(
$owner1
->
name
,
'owner1'
);
$this
->
assertEqual
(
$owner1
->
id
,
1
);
$check2
=
$this
->
connection
->
query
(
"FROM File_Owner WHERE File_Owner.id = "
.
$owner1
->
get
(
'id'
));
$check2
=
$this
->
connection
->
query
(
"FROM File_Owner WHERE File_Owner.id = "
.
$owner1
->
get
(
'id'
));
$this
->
assertEqual
(
1
,
count
(
$check2
));
$this
->
assertEqual
(
1
,
count
(
$check2
));
$check2
=
$check2
[
0
];
$check2
=
$check2
[
0
];
$this
->
assertEqual
(
'owner1'
,
$check2
->
get
(
'name'
));
$this
->
assertEqual
(
'owner1'
,
$check2
->
get
(
'name'
));
$this
->
assertTrue
(
isset
(
$owner1
->
Data_File
));
$this
->
assertTrue
(
isset
(
$owner1
->
Data_File
));
$this
->
assertFalse
(
isset
(
$owner2
->
Data_File
));
$this
->
assertFalse
(
isset
(
$owner2
->
Data_File
));
$this
->
assertEqual
(
1
,
$check
->
get
(
'id'
));
$this
->
assertEqual
(
1
,
$check
->
get
(
'id'
));
$this
->
assertEqual
(
1
,
$owner1
->
get
(
'id'
));
$this
->
assertEqual
(
1
,
$owner1
->
get
(
'id'
));
$this
->
assertEqual
(
$owner1
->
get
(
'id'
),
$check
->
get
(
'id'
));
$this
->
assertEqual
(
$owner1
->
get
(
'id'
),
$check
->
get
(
'id'
));
$this
->
assertEqual
(
2
,
$owner2
->
get
(
'id'
));
$this
->
assertEqual
(
2
,
$owner2
->
get
(
'id'
));
}
}
public
function
testAccessOneToOneFromLocalSide
()
{
public
function
testAccessOneToOneFromLocalSide
()
{
$check
=
$this
->
connection
->
query
(
"FROM Data_File WHERE Data_File.filename = 'file4'"
);
$check
=
$this
->
connection
->
query
(
"FROM Data_File WHERE Data_File.filename = 'file4'"
);
$file1
=
$this
->
connection
->
query
(
"FROM Data_File.File_Owner WHERE Data_File.filename = 'file4'"
);
$file1
=
$this
->
connection
->
query
(
"FROM Data_File.File_Owner WHERE Data_File.filename = 'file4'"
);
...
@@ -74,5 +84,6 @@ class Doctrine_RelationAccessTestCase extends Doctrine_UnitTestCase {
...
@@ -74,5 +84,6 @@ class Doctrine_RelationAccessTestCase extends Doctrine_UnitTestCase {
$this
->
assertEqual
(
1
,
$file2
->
get
(
'id'
));
$this
->
assertEqual
(
1
,
$file2
->
get
(
'id'
));
}
}
}
}
?>
?>
tests/run.php
View file @
1278934f
...
@@ -25,7 +25,7 @@ require_once("FilterTestCase.php");
...
@@ -25,7 +25,7 @@ require_once("FilterTestCase.php");
require_once
(
"ValueHolderTestCase.php"
);
require_once
(
"ValueHolderTestCase.php"
);
require_once
(
"QueryLimitTestCase.php"
);
require_once
(
"QueryLimitTestCase.php"
);
require_once
(
"QueryReferenceModelTestCase.php"
);
require_once
(
"QueryReferenceModelTestCase.php"
);
//
require_once("DBTestCase.php");
require_once
(
"DBTestCase.php"
);
require_once
(
"SchemaTestCase.php"
);
require_once
(
"SchemaTestCase.php"
);
require_once
(
"ImportTestCase.php"
);
require_once
(
"ImportTestCase.php"
);
require_once
(
"BooleanTestCase.php"
);
require_once
(
"BooleanTestCase.php"
);
...
@@ -37,7 +37,7 @@ error_reporting(E_ALL);
...
@@ -37,7 +37,7 @@ error_reporting(E_ALL);
$test
=
new
GroupTest
(
"Doctrine Framework Unit Tests"
);
$test
=
new
GroupTest
(
"Doctrine Framework Unit Tests"
);
//
$test->addTestCase(new Doctrine_DB_TestCase());
$test
->
addTestCase
(
new
Doctrine_DB_TestCase
());
$test
->
addTestCase
(
new
Doctrine_ConnectionTestCase
());
$test
->
addTestCase
(
new
Doctrine_ConnectionTestCase
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment