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
d6eb961c
Commit
d6eb961c
authored
Sep 08, 2006
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
loadRelated() now works for many-to-many associations
parent
7ef7031c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
14 deletions
+15
-14
Association.php
Doctrine/Association.php
+10
-7
Collection.php
Doctrine/Collection.php
+5
-7
No files found.
Doctrine/Association.php
View file @
d6eb961c
...
...
@@ -45,13 +45,16 @@ class Doctrine_Association extends Doctrine_Relation {
" WHERE "
.
$this
->
local
.
" IN ("
.
substr
(
str_repeat
(
"?, "
,
$count
),
0
,
-
2
)
.
")"
;
$dql
=
"FROM "
.
$this
->
table
->
getComponentName
();
if
(
$context
!=
'record'
)
$dql
.=
":"
.
$this
->
associationTable
->
getComponentName
();
$dql
.=
" WHERE "
.
$this
->
table
->
getComponentName
()
.
"."
.
$this
->
table
->
getIdentifier
()
.
" IN (
$sub
)"
;
switch
(
$context
)
:
case
"record"
:
$dql
=
"FROM "
.
$this
->
table
->
getComponentName
();
$dql
.=
":"
.
$this
->
associationTable
->
getComponentName
();
$dql
.=
" WHERE "
.
$this
->
table
->
getComponentName
()
.
"."
.
$this
->
table
->
getIdentifier
()
.
" IN (
$sub
)"
;
break
;
case
"collection"
:
$dql
=
"FROM "
.
$this
->
associationTable
->
getComponentName
()
.
"."
.
$this
->
table
->
getComponentName
();
$dql
.=
" WHERE "
.
$this
->
associationTable
->
getComponentName
()
.
"."
.
$this
->
local
.
" IN (
$sub
)"
;
endswitch
;
return
$dql
;
}
...
...
Doctrine/Collection.php
View file @
d6eb961c
...
...
@@ -624,9 +624,10 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
$list
[]
=
$value
;
endforeach
;
}
$rel
=
$this
->
table
->
getRelation
(
$name
);
$dql
=
$rel
->
getRelationDql
(
count
(
$list
),
'collection'
);
$coll
=
$query
->
query
(
$dql
,
$list
);
$this
->
populateRelated
(
$name
,
$coll
);
}
/**
...
...
@@ -677,16 +678,13 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
continue
;
$sub
=
new
Doctrine_Collection
(
$table
);
$association
=
$asf
->
getComponentName
();
foreach
(
$coll
as
$k
=>
$related
)
{
if
(
$related
[
$association
][
0
]
->
get
(
$local
)
==
$record
[
$identifier
])
{
$sub
->
add
(
$related
);
$coll
->
remove
(
$k
);
if
(
$related
->
get
(
$local
)
==
$record
[
$identifier
])
{
$sub
->
add
(
$related
->
get
(
$name
));
}
}
$this
->
data
[
$key
]
->
setRelated
(
$name
,
$sub
);
}
}
}
...
...
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