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
91988123
Commit
91988123
authored
Apr 16, 2006
by
doctrine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
4cf838a5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
10 deletions
+42
-10
Batch.class.php
classes/Collection/Batch.class.php
+3
-1
BatchIteratorTestCase.class.php
tests/BatchIteratorTestCase.class.php
+34
-2
classes.php
tests/classes.php
+2
-3
run.php
tests/run.php
+3
-4
No files found.
classes/Collection/Batch.class.php
View file @
91988123
...
...
@@ -102,11 +102,13 @@ class Doctrine_Collection_Batch extends Doctrine_Collection {
$query
.=
(
$c
>
1
)
?
"id IN ("
:
"id = "
;
$query
.=
substr
(
str_repeat
(
"?, "
,
count
(
$a
)),
0
,
-
2
);
$query
.=
(
$c
>
1
)
?
")"
:
""
;
$query
.=
" ORDER BY id ASC"
;
$stmt
=
$this
->
table
->
getSession
()
->
execute
(
$query
,
array_values
(
$a
));
foreach
(
$a
as
$k
=>
$id
)
{
foreach
(
$a
as
$k
=>
$id
)
{
$row
=
$stmt
->
fetch
(
PDO
::
FETCH_ASSOC
);
if
(
$row
===
false
)
break
;
...
...
tests/BatchIteratorTestCase.class.php
View file @
91988123
...
...
@@ -13,8 +13,40 @@ class Doctrine_BatchIteratorTestCase extends Doctrine_UnitTestCase {
$user
=
$graph
->
query
(
"FROM User"
);
foreach
(
$user
[
1
]
->
Group
as
$group
)
{
print
$group
->
name
;
}
$this
->
assertTrue
(
is_string
(
$group
->
name
));
}
$user
=
new
User
();
$user
->
name
=
"tester"
;
$user
->
Address
[
0
]
->
address
=
"street 1"
;
$user
->
Address
[
1
]
->
address
=
"street 2"
;
$this
->
assertEqual
(
$user
->
name
,
"tester"
);
$this
->
assertEqual
(
$user
->
Address
[
0
]
->
address
,
"street 1"
);
$this
->
assertEqual
(
$user
->
Address
[
1
]
->
address
,
"street 2"
);
foreach
(
$user
->
Address
as
$address
)
{
$a
[]
=
$address
->
address
;
}
$this
->
assertEqual
(
$a
,
array
(
"street 1"
,
"street 2"
));
$user
->
save
();
$user
=
$user
->
getTable
()
->
find
(
$user
->
getID
());
$this
->
assertEqual
(
$user
->
name
,
"tester"
);
$this
->
assertEqual
(
$user
->
Address
[
0
]
->
address
,
"street 1"
);
$this
->
assertEqual
(
$user
->
Address
[
1
]
->
address
,
"street 2"
);
$user
=
$user
->
getTable
()
->
find
(
$user
->
getID
());
$a
=
array
();
foreach
(
$user
->
Address
as
$address
)
{
$a
[]
=
$address
->
address
;
}
$this
->
assertEqual
(
$a
,
array
(
"street 1"
,
"street 2"
));
$user
=
$graph
->
query
(
"FROM User"
);
}
}
...
...
tests/classes.php
View file @
91988123
...
...
@@ -3,8 +3,6 @@ class Entity extends Doctrine_Record {
public
function
setUp
()
{
$this
->
ownsOne
(
"Email"
,
"Entity.email_id"
);
$this
->
ownsMany
(
"Phonenumber"
,
"Phonenumber.entity_id"
);
$this
->
hasMany
(
"Address"
,
"Entityaddress.address_id"
);
$this
->
setAttribute
(
Doctrine
::
ATTR_FETCHMODE
,
Doctrine
::
FETCH_BATCH
);
}
public
function
setTableDefinition
()
{
...
...
@@ -25,7 +23,7 @@ class EntityAddress extends Doctrine_Record {
}
class
Address
extends
Doctrine_Record
{
public
function
setUp
()
{
$this
->
hasMany
(
"
Entity"
,
"Entityaddress.entity_id"
);
$this
->
hasMany
(
"
User"
,
"Entityaddress.entity_id"
);
}
public
function
setTableDefinition
()
{
$this
->
hasColumn
(
"address"
,
"string"
,
200
);
...
...
@@ -63,6 +61,7 @@ class UserTable extends Doctrine_Table { }
class
User
extends
Entity
{
public
function
setUp
()
{
parent
::
setUp
();
$this
->
hasMany
(
"Address"
,
"Entityaddress.address_id"
);
$this
->
ownsMany
(
"Album"
,
"Album.user_id"
);
$this
->
hasMany
(
"Group"
,
"Groupuser.group_id"
);
$this
->
setInheritanceMap
(
array
(
"type"
=>
0
));
...
...
tests/run.php
View file @
91988123
...
...
@@ -24,7 +24,7 @@ $test = new GroupTest("Doctrine Framework Unit Tests");
/**
$test
->
addTestCase
(
new
Doctrine_RecordTestCase
());
...
...
@@ -39,17 +39,16 @@ $test->addTestCase(new Doctrine_AccessTestCase());
$test
->
addTestCase
(
new
Doctrine_EventListenerTestCase
());
*/
$test
->
addTestCase
(
new
Doctrine_BatchIteratorTestCase
());
/**
$test
->
addTestCase
(
new
Doctrine_DQL_ParserTestCase
());
$test
->
addTestCase
(
new
Doctrine_CollectionTestCase
());
$test
->
addTestCase
(
new
Doctrine_ConfigurableTestCase
());
$test
->
addTestCase
(
new
Sensei_UnitTestCase
());
*/
//$test->addTestCase(new Doctrine_Cache_FileTestCase());
//$test->addTestCase(new Doctrine_Cache_SqliteTestCase());
...
...
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