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
865f6206
Commit
865f6206
authored
May 30, 2006
by
doctrine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DQL: Fixed lazy property fetching with multiple components
parent
776c47f7
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
3 deletions
+56
-3
Query.php
Doctrine/Query.php
+1
-1
Record.php
Doctrine/Record.php
+4
-0
QueryTestCase.class.php
tests/QueryTestCase.class.php
+49
-0
run.php
tests/run.php
+2
-2
No files found.
Doctrine/Query.php
View file @
865f6206
...
...
@@ -716,7 +716,7 @@ class Doctrine_Query extends Doctrine_Access {
* @return void
*/
private
function
parseFrom
(
$str
)
{
foreach
(
explode
(
","
,
trim
(
$str
)
)
as
$reference
)
{
foreach
(
self
::
bracketExplode
(
trim
(
$str
),
","
,
"("
,
")"
)
as
$reference
)
{
$reference
=
trim
(
$reference
);
$table
=
$this
->
load
(
$reference
);
}
...
...
Doctrine/Record.php
View file @
865f6206
...
...
@@ -364,6 +364,8 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
$this
->
state
=
Doctrine_Record
::
STATE_CLEAN
;
$this
->
table
->
getAttribute
(
Doctrine
::
ATTR_LISTENER
)
->
onLoad
(
$this
);
return
true
;
}
/**
...
...
@@ -386,6 +388,8 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
$this
->
state
=
Doctrine_Record
::
STATE_CLEAN
;
$this
->
modified
=
array
();
$this
->
table
->
getAttribute
(
Doctrine
::
ATTR_LISTENER
)
->
onLoad
(
$this
);
}
/**
* return the factory that created this data access object
...
...
tests/QueryTestCase.class.php
View file @
865f6206
...
...
@@ -7,7 +7,54 @@ class Doctrine_QueryTestCase extends Doctrine_UnitTestCase {
$this
->
tables
[]
=
"Forum_Thread"
;
parent
::
prepareTables
();
}
public
function
testLazyPropertyFetchingWithMultipleColumns
()
{
$q
=
new
Doctrine_Query
(
$this
->
session
);
$q
->
from
(
"User-l(name, email_id)"
);
$users
=
$q
->
execute
();
$this
->
assertEqual
(
$users
->
count
(),
8
);
$this
->
assertTrue
(
$users
instanceof
Doctrine_Collection_Lazy
);
$count
=
count
(
$this
->
dbh
);
$this
->
assertTrue
(
is_string
(
$users
[
0
]
->
name
));
$this
->
assertEqual
(
$count
,
count
(
$this
->
dbh
));
$count
=
count
(
$this
->
dbh
);
$this
->
assertTrue
(
is_numeric
(
$users
[
0
]
->
email_id
));
$this
->
assertEqual
(
$count
,
count
(
$this
->
dbh
));
$users
[
0
]
->
getTable
()
->
clear
();
$q
->
from
(
"User-b(name, email_id)"
);
$users
=
$q
->
execute
();
$this
->
assertEqual
(
$users
->
count
(),
8
);
$this
->
assertTrue
(
$users
instanceof
Doctrine_Collection_Batch
);
$count
=
count
(
$this
->
dbh
);
$this
->
assertTrue
(
is_string
(
$users
[
0
]
->
name
));
$this
->
assertEqual
(
$count
,
count
(
$this
->
dbh
));
$count
=
count
(
$this
->
dbh
);
$this
->
assertTrue
(
is_numeric
(
$users
[
0
]
->
email_id
));
$this
->
assertEqual
(
$count
,
count
(
$this
->
dbh
));
$this
->
assertTrue
(
is_numeric
(
$users
[
1
]
->
email_id
));
$this
->
assertEqual
(
$count
,
count
(
$this
->
dbh
));
$this
->
assertTrue
(
is_numeric
(
$users
[
2
]
->
email_id
));
$this
->
assertEqual
(
$count
,
count
(
$this
->
dbh
));
$q
->
from
(
"User-b(name, email_id):Email, User-b(name, email_id).Phonenumber"
);
$users
=
$q
->
execute
();
$this
->
assertEqual
(
$users
->
count
(),
8
);
$this
->
assertTrue
(
$users
instanceof
Doctrine_Collection_Batch
);
$count
=
count
(
$this
->
dbh
);
$this
->
assertTrue
(
is_string
(
$users
[
0
]
->
name
));
$this
->
assertEqual
(
$count
,
count
(
$this
->
dbh
));
$count
=
count
(
$this
->
dbh
);
$this
->
assertTrue
(
is_numeric
(
$users
[
0
]
->
email_id
));
$this
->
assertEqual
(
$count
,
count
(
$this
->
dbh
));
$this
->
assertTrue
(
is_numeric
(
$users
[
1
]
->
email_id
));
$this
->
assertEqual
(
$count
,
count
(
$this
->
dbh
));
$this
->
assertTrue
(
is_numeric
(
$users
[
2
]
->
email_id
));
$this
->
assertEqual
(
$count
,
count
(
$this
->
dbh
));
}
/**
public function testMultipleFetching() {
$count = $this->dbh->count();
$this->session->getTable('User')->clear();
...
...
@@ -125,6 +172,7 @@ class Doctrine_QueryTestCase extends Doctrine_UnitTestCase {
}
$this->assertTrue($f);
}
public function testValidLazyPropertyFetching() {
$q = new Doctrine_Query($this->session);
$q->from("User-l(name)");
...
...
@@ -517,5 +565,6 @@ class Doctrine_QueryTestCase extends Doctrine_UnitTestCase {
//$this->assertTrue(isset($values['max']));
}
*/
}
?>
tests/run.php
View file @
865f6206
...
...
@@ -23,7 +23,7 @@ error_reporting(E_ALL);
$test
=
new
GroupTest
(
"Doctrine Framework Unit Tests"
);
//$test->addTestCase(new Sensei_UnitTestCase());
/**
$test->addTestCase(new Doctrine_RecordTestCase());
$test->addTestCase(new Doctrine_SessionTestCase());
...
...
@@ -45,7 +45,7 @@ $test->addTestCase(new Doctrine_ConfigurableTestCase());
$test->addTestCase(new Doctrine_Collection_OffsetTestCase());
$test->addTestCase(new Doctrine_CollectionTestCase());
*/
$test
->
addTestCase
(
new
Doctrine_QueryTestCase
());
//$test->addTestCase(new Doctrine_Cache_FileTestCase());
...
...
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