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
7ec25f19
Commit
7ec25f19
authored
Oct 12, 2009
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0] Added missing recognition of the 'fetch' attribute in metadata drivers.
parent
f731a083
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
6 deletions
+44
-6
AssociationMapping.php
lib/Doctrine/ORM/Mapping/AssociationMapping.php
+3
-1
AnnotationDriver.php
lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php
+4
-0
DoctrineAnnotations.php
lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php
+4
-4
XmlDriver.php
lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
+17
-1
YamlDriver.php
lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
+16
-0
No files found.
lib/Doctrine/ORM/Mapping/AssociationMapping.php
View file @
7ec25f19
...
...
@@ -72,7 +72,7 @@ abstract class AssociationMapping
*
* @var integer
*/
public
$fetchMode
=
self
::
FETCH_LAZY
;
public
$fetchMode
;
/**
* Flag that indicates whether the class that defines this mapping is
...
...
@@ -182,6 +182,8 @@ abstract class AssociationMapping
// Optional attributes for both sides
$this
->
isOptional
=
isset
(
$mapping
[
'optional'
])
?
(
bool
)
$mapping
[
'optional'
]
:
true
;
$this
->
fetchMode
=
isset
(
$mapping
[
'fetch'
])
?
$mapping
[
'fetch'
]
:
self
::
FETCH_LAZY
;
$this
->
cascades
=
isset
(
$mapping
[
'cascade'
])
?
(
array
)
$mapping
[
'cascade'
]
:
array
();
$this
->
isCascadeRemove
=
in_array
(
'remove'
,
$this
->
cascades
);
...
...
lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php
View file @
7ec25f19
...
...
@@ -224,17 +224,20 @@ class AnnotationDriver implements Driver
$mapping
[
'mappedBy'
]
=
$oneToOneAnnot
->
mappedBy
;
$mapping
[
'cascade'
]
=
$oneToOneAnnot
->
cascade
;
$mapping
[
'orphanRemoval'
]
=
$oneToOneAnnot
->
orphanRemoval
;
$mapping
[
'fetch'
]
=
constant
(
'Doctrine\ORM\Mapping\AssociationMapping::FETCH_'
.
$oneToOneAnnot
->
fetch
);
$metadata
->
mapOneToOne
(
$mapping
);
}
else
if
(
$oneToManyAnnot
=
$this
->
_reader
->
getPropertyAnnotation
(
$property
,
'Doctrine\ORM\Mapping\OneToMany'
))
{
$mapping
[
'mappedBy'
]
=
$oneToManyAnnot
->
mappedBy
;
$mapping
[
'targetEntity'
]
=
$oneToManyAnnot
->
targetEntity
;
$mapping
[
'cascade'
]
=
$oneToManyAnnot
->
cascade
;
$mapping
[
'orphanRemoval'
]
=
$oneToManyAnnot
->
orphanRemoval
;
$mapping
[
'fetch'
]
=
constant
(
'Doctrine\ORM\Mapping\AssociationMapping::FETCH_'
.
$oneToManyAnnot
->
fetch
);
$metadata
->
mapOneToMany
(
$mapping
);
}
else
if
(
$manyToOneAnnot
=
$this
->
_reader
->
getPropertyAnnotation
(
$property
,
'Doctrine\ORM\Mapping\ManyToOne'
))
{
$mapping
[
'joinColumns'
]
=
$joinColumns
;
$mapping
[
'cascade'
]
=
$manyToOneAnnot
->
cascade
;
$mapping
[
'targetEntity'
]
=
$manyToOneAnnot
->
targetEntity
;
$mapping
[
'fetch'
]
=
constant
(
'Doctrine\ORM\Mapping\AssociationMapping::FETCH_'
.
$manyToOneAnnot
->
fetch
);
$metadata
->
mapManyToOne
(
$mapping
);
}
else
if
(
$manyToManyAnnot
=
$this
->
_reader
->
getPropertyAnnotation
(
$property
,
'Doctrine\ORM\Mapping\ManyToMany'
))
{
$joinTable
=
array
();
...
...
@@ -272,6 +275,7 @@ class AnnotationDriver implements Driver
$mapping
[
'targetEntity'
]
=
$manyToManyAnnot
->
targetEntity
;
$mapping
[
'mappedBy'
]
=
$manyToManyAnnot
->
mappedBy
;
$mapping
[
'cascade'
]
=
$manyToManyAnnot
->
cascade
;
$mapping
[
'fetch'
]
=
constant
(
'Doctrine\ORM\Mapping\AssociationMapping::FETCH_'
.
$manyToManyAnnot
->
fetch
);
$metadata
->
mapManyToMany
(
$mapping
);
}
}
...
...
lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php
View file @
7ec25f19
...
...
@@ -68,7 +68,7 @@ final class OneToOne extends Annotation {
public
$targetEntity
;
public
$mappedBy
;
public
$cascade
;
public
$fetch
;
public
$fetch
=
'LAZY'
;
public
$optional
;
public
$orphanRemoval
=
false
;
}
...
...
@@ -76,20 +76,20 @@ final class OneToMany extends Annotation {
public
$mappedBy
;
public
$targetEntity
;
public
$cascade
;
public
$fetch
;
public
$fetch
=
'LAZY'
;
public
$orphanRemoval
=
false
;
}
final
class
ManyToOne
extends
Annotation
{
public
$targetEntity
;
public
$cascade
;
public
$fetch
;
public
$fetch
=
'LAZY'
;
public
$optional
;
}
final
class
ManyToMany
extends
Annotation
{
public
$targetEntity
;
public
$mappedBy
;
public
$cascade
;
public
$fetch
;
public
$fetch
=
'LAZY'
;
}
final
class
ElementCollection
extends
Annotation
{
public
$tableName
;
...
...
lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
View file @
7ec25f19
...
...
@@ -195,9 +195,13 @@ class XmlDriver extends AbstractFileDriver
foreach
(
$xmlRoot
->
{
'one-to-one'
}
as
$oneToOneElement
)
{
$mapping
=
array
(
'fieldName'
=>
(
string
)
$oneToOneElement
[
'field'
],
'targetEntity'
=>
(
string
)
$oneToOneElement
[
'target-entity'
]
,
'targetEntity'
=>
(
string
)
$oneToOneElement
[
'target-entity'
]
);
if
(
isset
(
$oneToOneElement
[
'fetch'
]))
{
$mapping
[
'fetch'
]
=
constant
(
'Doctrine\ORM\Mapping\AssociationMapping::FETCH_'
.
(
string
)
$oneToOneElement
[
'fetch'
]);
}
if
(
isset
(
$oneToOneElement
[
'mapped-by'
]))
{
$mapping
[
'mappedBy'
]
=
(
string
)
$oneToOneElement
[
'mapped-by'
];
}
else
{
...
...
@@ -237,6 +241,10 @@ class XmlDriver extends AbstractFileDriver
'mappedBy'
=>
(
string
)
$oneToManyElement
[
'mapped-by'
]
);
if
(
isset
(
$oneToManyElement
[
'fetch'
]))
{
$mapping
[
'fetch'
]
=
constant
(
'Doctrine\ORM\Mapping\AssociationMapping::FETCH_'
.
(
string
)
$oneToManyElement
[
'fetch'
]);
}
if
(
isset
(
$oneToManyElement
->
cascade
))
{
$mapping
[
'cascade'
]
=
$this
->
_getCascadeMappings
(
$oneToManyElement
->
cascade
);
}
...
...
@@ -257,6 +265,10 @@ class XmlDriver extends AbstractFileDriver
'targetEntity'
=>
(
string
)
$manyToOneElement
[
'target-entity'
]
);
if
(
isset
(
$manyToOneElement
[
'fetch'
]))
{
$mapping
[
'fetch'
]
=
constant
(
'Doctrine\ORM\Mapping\AssociationMapping::FETCH_'
.
(
string
)
$manyToOneElement
[
'fetch'
]);
}
$joinColumns
=
array
();
if
(
isset
(
$manyToOneElement
->
{
'join-column'
}))
{
...
...
@@ -295,6 +307,10 @@ class XmlDriver extends AbstractFileDriver
'targetEntity'
=>
(
string
)
$manyToManyElement
[
'target-entity'
]
);
if
(
isset
(
$manyToManyElement
[
'fetch'
]))
{
$mapping
[
'fetch'
]
=
constant
(
'Doctrine\ORM\Mapping\AssociationMapping::FETCH_'
.
(
string
)
$manyToManyElement
[
'fetch'
]);
}
if
(
isset
(
$manyToManyElement
[
'mappedBy'
]))
{
$mapping
[
'mappedBy'
]
=
(
string
)
$manyToManyElement
[
'mapped-by'
];
}
else
if
(
isset
(
$manyToManyElement
->
{
'join-table'
}))
{
...
...
lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
View file @
7ec25f19
...
...
@@ -208,6 +208,10 @@ class YamlDriver extends AbstractFileDriver
'targetEntity'
=>
$oneToOneElement
[
'targetEntity'
]
);
if
(
isset
(
$oneToOneElement
[
'fetch'
]))
{
$mapping
[
'fetch'
]
=
constant
(
'Doctrine\ORM\Mapping\AssociationMapping::FETCH_'
.
$oneToOneElement
[
'fetch'
]);
}
if
(
isset
(
$oneToOneElement
[
'mappedBy'
]))
{
$mapping
[
'mappedBy'
]
=
$oneToOneElement
[
'mappedBy'
];
}
else
{
...
...
@@ -247,6 +251,10 @@ class YamlDriver extends AbstractFileDriver
'mappedBy'
=>
$oneToManyElement
[
'mappedBy'
]
);
if
(
isset
(
$oneToManyElement
[
'fetch'
]))
{
$mapping
[
'fetch'
]
=
constant
(
'Doctrine\ORM\Mapping\AssociationMapping::FETCH_'
.
$oneToManyElement
[
'fetch'
]);
}
if
(
isset
(
$oneToManyElement
[
'cascade'
]))
{
$mapping
[
'cascade'
]
=
$this
->
_getCascadeMappings
(
$oneToManyElement
[
'cascade'
]);
}
...
...
@@ -263,6 +271,10 @@ class YamlDriver extends AbstractFileDriver
'targetEntity'
=>
$manyToOneElement
[
'targetEntity'
]
);
if
(
isset
(
$manyToOneElement
[
'fetch'
]))
{
$mapping
[
'fetch'
]
=
constant
(
'Doctrine\ORM\Mapping\AssociationMapping::FETCH_'
.
$manyToOneElement
[
'fetch'
]);
}
$joinColumns
=
array
();
if
(
isset
(
$manyToOneElement
[
'joinColumn'
]))
{
...
...
@@ -297,6 +309,10 @@ class YamlDriver extends AbstractFileDriver
'targetEntity'
=>
$manyToManyElement
[
'targetEntity'
]
);
if
(
isset
(
$manyToManyElement
[
'fetch'
]))
{
$mapping
[
'fetch'
]
=
constant
(
'Doctrine\ORM\Mapping\AssociationMapping::FETCH_'
.
$manyToManyElement
[
'fetch'
]);
}
if
(
isset
(
$manyToManyElement
[
'mappedBy'
]))
{
$mapping
[
'mappedBy'
]
=
$manyToManyElement
[
'mappedBy'
];
}
else
if
(
isset
(
$manyToManyElement
[
'joinTable'
]))
{
...
...
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