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
Show 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
...
@@ -72,7 +72,7 @@ abstract class AssociationMapping
*
*
* @var integer
* @var integer
*/
*/
public
$fetchMode
=
self
::
FETCH_LAZY
;
public
$fetchMode
;
/**
/**
* Flag that indicates whether the class that defines this mapping is
* Flag that indicates whether the class that defines this mapping is
...
@@ -182,6 +182,8 @@ abstract class AssociationMapping
...
@@ -182,6 +182,8 @@ abstract class AssociationMapping
// Optional attributes for both sides
// Optional attributes for both sides
$this
->
isOptional
=
isset
(
$mapping
[
'optional'
])
?
$this
->
isOptional
=
isset
(
$mapping
[
'optional'
])
?
(
bool
)
$mapping
[
'optional'
]
:
true
;
(
bool
)
$mapping
[
'optional'
]
:
true
;
$this
->
fetchMode
=
isset
(
$mapping
[
'fetch'
])
?
$mapping
[
'fetch'
]
:
self
::
FETCH_LAZY
;
$this
->
cascades
=
isset
(
$mapping
[
'cascade'
])
?
$this
->
cascades
=
isset
(
$mapping
[
'cascade'
])
?
(
array
)
$mapping
[
'cascade'
]
:
array
();
(
array
)
$mapping
[
'cascade'
]
:
array
();
$this
->
isCascadeRemove
=
in_array
(
'remove'
,
$this
->
cascades
);
$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
...
@@ -224,17 +224,20 @@ class AnnotationDriver implements Driver
$mapping
[
'mappedBy'
]
=
$oneToOneAnnot
->
mappedBy
;
$mapping
[
'mappedBy'
]
=
$oneToOneAnnot
->
mappedBy
;
$mapping
[
'cascade'
]
=
$oneToOneAnnot
->
cascade
;
$mapping
[
'cascade'
]
=
$oneToOneAnnot
->
cascade
;
$mapping
[
'orphanRemoval'
]
=
$oneToOneAnnot
->
orphanRemoval
;
$mapping
[
'orphanRemoval'
]
=
$oneToOneAnnot
->
orphanRemoval
;
$mapping
[
'fetch'
]
=
constant
(
'Doctrine\ORM\Mapping\AssociationMapping::FETCH_'
.
$oneToOneAnnot
->
fetch
);
$metadata
->
mapOneToOne
(
$mapping
);
$metadata
->
mapOneToOne
(
$mapping
);
}
else
if
(
$oneToManyAnnot
=
$this
->
_reader
->
getPropertyAnnotation
(
$property
,
'Doctrine\ORM\Mapping\OneToMany'
))
{
}
else
if
(
$oneToManyAnnot
=
$this
->
_reader
->
getPropertyAnnotation
(
$property
,
'Doctrine\ORM\Mapping\OneToMany'
))
{
$mapping
[
'mappedBy'
]
=
$oneToManyAnnot
->
mappedBy
;
$mapping
[
'mappedBy'
]
=
$oneToManyAnnot
->
mappedBy
;
$mapping
[
'targetEntity'
]
=
$oneToManyAnnot
->
targetEntity
;
$mapping
[
'targetEntity'
]
=
$oneToManyAnnot
->
targetEntity
;
$mapping
[
'cascade'
]
=
$oneToManyAnnot
->
cascade
;
$mapping
[
'cascade'
]
=
$oneToManyAnnot
->
cascade
;
$mapping
[
'orphanRemoval'
]
=
$oneToManyAnnot
->
orphanRemoval
;
$mapping
[
'orphanRemoval'
]
=
$oneToManyAnnot
->
orphanRemoval
;
$mapping
[
'fetch'
]
=
constant
(
'Doctrine\ORM\Mapping\AssociationMapping::FETCH_'
.
$oneToManyAnnot
->
fetch
);
$metadata
->
mapOneToMany
(
$mapping
);
$metadata
->
mapOneToMany
(
$mapping
);
}
else
if
(
$manyToOneAnnot
=
$this
->
_reader
->
getPropertyAnnotation
(
$property
,
'Doctrine\ORM\Mapping\ManyToOne'
))
{
}
else
if
(
$manyToOneAnnot
=
$this
->
_reader
->
getPropertyAnnotation
(
$property
,
'Doctrine\ORM\Mapping\ManyToOne'
))
{
$mapping
[
'joinColumns'
]
=
$joinColumns
;
$mapping
[
'joinColumns'
]
=
$joinColumns
;
$mapping
[
'cascade'
]
=
$manyToOneAnnot
->
cascade
;
$mapping
[
'cascade'
]
=
$manyToOneAnnot
->
cascade
;
$mapping
[
'targetEntity'
]
=
$manyToOneAnnot
->
targetEntity
;
$mapping
[
'targetEntity'
]
=
$manyToOneAnnot
->
targetEntity
;
$mapping
[
'fetch'
]
=
constant
(
'Doctrine\ORM\Mapping\AssociationMapping::FETCH_'
.
$manyToOneAnnot
->
fetch
);
$metadata
->
mapManyToOne
(
$mapping
);
$metadata
->
mapManyToOne
(
$mapping
);
}
else
if
(
$manyToManyAnnot
=
$this
->
_reader
->
getPropertyAnnotation
(
$property
,
'Doctrine\ORM\Mapping\ManyToMany'
))
{
}
else
if
(
$manyToManyAnnot
=
$this
->
_reader
->
getPropertyAnnotation
(
$property
,
'Doctrine\ORM\Mapping\ManyToMany'
))
{
$joinTable
=
array
();
$joinTable
=
array
();
...
@@ -272,6 +275,7 @@ class AnnotationDriver implements Driver
...
@@ -272,6 +275,7 @@ class AnnotationDriver implements Driver
$mapping
[
'targetEntity'
]
=
$manyToManyAnnot
->
targetEntity
;
$mapping
[
'targetEntity'
]
=
$manyToManyAnnot
->
targetEntity
;
$mapping
[
'mappedBy'
]
=
$manyToManyAnnot
->
mappedBy
;
$mapping
[
'mappedBy'
]
=
$manyToManyAnnot
->
mappedBy
;
$mapping
[
'cascade'
]
=
$manyToManyAnnot
->
cascade
;
$mapping
[
'cascade'
]
=
$manyToManyAnnot
->
cascade
;
$mapping
[
'fetch'
]
=
constant
(
'Doctrine\ORM\Mapping\AssociationMapping::FETCH_'
.
$manyToManyAnnot
->
fetch
);
$metadata
->
mapManyToMany
(
$mapping
);
$metadata
->
mapManyToMany
(
$mapping
);
}
}
}
}
...
...
lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php
View file @
7ec25f19
...
@@ -68,7 +68,7 @@ final class OneToOne extends Annotation {
...
@@ -68,7 +68,7 @@ final class OneToOne extends Annotation {
public
$targetEntity
;
public
$targetEntity
;
public
$mappedBy
;
public
$mappedBy
;
public
$cascade
;
public
$cascade
;
public
$fetch
;
public
$fetch
=
'LAZY'
;
public
$optional
;
public
$optional
;
public
$orphanRemoval
=
false
;
public
$orphanRemoval
=
false
;
}
}
...
@@ -76,20 +76,20 @@ final class OneToMany extends Annotation {
...
@@ -76,20 +76,20 @@ final class OneToMany extends Annotation {
public
$mappedBy
;
public
$mappedBy
;
public
$targetEntity
;
public
$targetEntity
;
public
$cascade
;
public
$cascade
;
public
$fetch
;
public
$fetch
=
'LAZY'
;
public
$orphanRemoval
=
false
;
public
$orphanRemoval
=
false
;
}
}
final
class
ManyToOne
extends
Annotation
{
final
class
ManyToOne
extends
Annotation
{
public
$targetEntity
;
public
$targetEntity
;
public
$cascade
;
public
$cascade
;
public
$fetch
;
public
$fetch
=
'LAZY'
;
public
$optional
;
public
$optional
;
}
}
final
class
ManyToMany
extends
Annotation
{
final
class
ManyToMany
extends
Annotation
{
public
$targetEntity
;
public
$targetEntity
;
public
$mappedBy
;
public
$mappedBy
;
public
$cascade
;
public
$cascade
;
public
$fetch
;
public
$fetch
=
'LAZY'
;
}
}
final
class
ElementCollection
extends
Annotation
{
final
class
ElementCollection
extends
Annotation
{
public
$tableName
;
public
$tableName
;
...
...
lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
View file @
7ec25f19
...
@@ -195,9 +195,13 @@ class XmlDriver extends AbstractFileDriver
...
@@ -195,9 +195,13 @@ class XmlDriver extends AbstractFileDriver
foreach
(
$xmlRoot
->
{
'one-to-one'
}
as
$oneToOneElement
)
{
foreach
(
$xmlRoot
->
{
'one-to-one'
}
as
$oneToOneElement
)
{
$mapping
=
array
(
$mapping
=
array
(
'fieldName'
=>
(
string
)
$oneToOneElement
[
'field'
],
'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'
]))
{
if
(
isset
(
$oneToOneElement
[
'mapped-by'
]))
{
$mapping
[
'mappedBy'
]
=
(
string
)
$oneToOneElement
[
'mapped-by'
];
$mapping
[
'mappedBy'
]
=
(
string
)
$oneToOneElement
[
'mapped-by'
];
}
else
{
}
else
{
...
@@ -237,6 +241,10 @@ class XmlDriver extends AbstractFileDriver
...
@@ -237,6 +241,10 @@ class XmlDriver extends AbstractFileDriver
'mappedBy'
=>
(
string
)
$oneToManyElement
[
'mapped-by'
]
'mappedBy'
=>
(
string
)
$oneToManyElement
[
'mapped-by'
]
);
);
if
(
isset
(
$oneToManyElement
[
'fetch'
]))
{
$mapping
[
'fetch'
]
=
constant
(
'Doctrine\ORM\Mapping\AssociationMapping::FETCH_'
.
(
string
)
$oneToManyElement
[
'fetch'
]);
}
if
(
isset
(
$oneToManyElement
->
cascade
))
{
if
(
isset
(
$oneToManyElement
->
cascade
))
{
$mapping
[
'cascade'
]
=
$this
->
_getCascadeMappings
(
$oneToManyElement
->
cascade
);
$mapping
[
'cascade'
]
=
$this
->
_getCascadeMappings
(
$oneToManyElement
->
cascade
);
}
}
...
@@ -257,6 +265,10 @@ class XmlDriver extends AbstractFileDriver
...
@@ -257,6 +265,10 @@ class XmlDriver extends AbstractFileDriver
'targetEntity'
=>
(
string
)
$manyToOneElement
[
'target-entity'
]
'targetEntity'
=>
(
string
)
$manyToOneElement
[
'target-entity'
]
);
);
if
(
isset
(
$manyToOneElement
[
'fetch'
]))
{
$mapping
[
'fetch'
]
=
constant
(
'Doctrine\ORM\Mapping\AssociationMapping::FETCH_'
.
(
string
)
$manyToOneElement
[
'fetch'
]);
}
$joinColumns
=
array
();
$joinColumns
=
array
();
if
(
isset
(
$manyToOneElement
->
{
'join-column'
}))
{
if
(
isset
(
$manyToOneElement
->
{
'join-column'
}))
{
...
@@ -295,6 +307,10 @@ class XmlDriver extends AbstractFileDriver
...
@@ -295,6 +307,10 @@ class XmlDriver extends AbstractFileDriver
'targetEntity'
=>
(
string
)
$manyToManyElement
[
'target-entity'
]
'targetEntity'
=>
(
string
)
$manyToManyElement
[
'target-entity'
]
);
);
if
(
isset
(
$manyToManyElement
[
'fetch'
]))
{
$mapping
[
'fetch'
]
=
constant
(
'Doctrine\ORM\Mapping\AssociationMapping::FETCH_'
.
(
string
)
$manyToManyElement
[
'fetch'
]);
}
if
(
isset
(
$manyToManyElement
[
'mappedBy'
]))
{
if
(
isset
(
$manyToManyElement
[
'mappedBy'
]))
{
$mapping
[
'mappedBy'
]
=
(
string
)
$manyToManyElement
[
'mapped-by'
];
$mapping
[
'mappedBy'
]
=
(
string
)
$manyToManyElement
[
'mapped-by'
];
}
else
if
(
isset
(
$manyToManyElement
->
{
'join-table'
}))
{
}
else
if
(
isset
(
$manyToManyElement
->
{
'join-table'
}))
{
...
...
lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
View file @
7ec25f19
...
@@ -208,6 +208,10 @@ class YamlDriver extends AbstractFileDriver
...
@@ -208,6 +208,10 @@ class YamlDriver extends AbstractFileDriver
'targetEntity'
=>
$oneToOneElement
[
'targetEntity'
]
'targetEntity'
=>
$oneToOneElement
[
'targetEntity'
]
);
);
if
(
isset
(
$oneToOneElement
[
'fetch'
]))
{
$mapping
[
'fetch'
]
=
constant
(
'Doctrine\ORM\Mapping\AssociationMapping::FETCH_'
.
$oneToOneElement
[
'fetch'
]);
}
if
(
isset
(
$oneToOneElement
[
'mappedBy'
]))
{
if
(
isset
(
$oneToOneElement
[
'mappedBy'
]))
{
$mapping
[
'mappedBy'
]
=
$oneToOneElement
[
'mappedBy'
];
$mapping
[
'mappedBy'
]
=
$oneToOneElement
[
'mappedBy'
];
}
else
{
}
else
{
...
@@ -247,6 +251,10 @@ class YamlDriver extends AbstractFileDriver
...
@@ -247,6 +251,10 @@ class YamlDriver extends AbstractFileDriver
'mappedBy'
=>
$oneToManyElement
[
'mappedBy'
]
'mappedBy'
=>
$oneToManyElement
[
'mappedBy'
]
);
);
if
(
isset
(
$oneToManyElement
[
'fetch'
]))
{
$mapping
[
'fetch'
]
=
constant
(
'Doctrine\ORM\Mapping\AssociationMapping::FETCH_'
.
$oneToManyElement
[
'fetch'
]);
}
if
(
isset
(
$oneToManyElement
[
'cascade'
]))
{
if
(
isset
(
$oneToManyElement
[
'cascade'
]))
{
$mapping
[
'cascade'
]
=
$this
->
_getCascadeMappings
(
$oneToManyElement
[
'cascade'
]);
$mapping
[
'cascade'
]
=
$this
->
_getCascadeMappings
(
$oneToManyElement
[
'cascade'
]);
}
}
...
@@ -263,6 +271,10 @@ class YamlDriver extends AbstractFileDriver
...
@@ -263,6 +271,10 @@ class YamlDriver extends AbstractFileDriver
'targetEntity'
=>
$manyToOneElement
[
'targetEntity'
]
'targetEntity'
=>
$manyToOneElement
[
'targetEntity'
]
);
);
if
(
isset
(
$manyToOneElement
[
'fetch'
]))
{
$mapping
[
'fetch'
]
=
constant
(
'Doctrine\ORM\Mapping\AssociationMapping::FETCH_'
.
$manyToOneElement
[
'fetch'
]);
}
$joinColumns
=
array
();
$joinColumns
=
array
();
if
(
isset
(
$manyToOneElement
[
'joinColumn'
]))
{
if
(
isset
(
$manyToOneElement
[
'joinColumn'
]))
{
...
@@ -297,6 +309,10 @@ class YamlDriver extends AbstractFileDriver
...
@@ -297,6 +309,10 @@ class YamlDriver extends AbstractFileDriver
'targetEntity'
=>
$manyToManyElement
[
'targetEntity'
]
'targetEntity'
=>
$manyToManyElement
[
'targetEntity'
]
);
);
if
(
isset
(
$manyToManyElement
[
'fetch'
]))
{
$mapping
[
'fetch'
]
=
constant
(
'Doctrine\ORM\Mapping\AssociationMapping::FETCH_'
.
$manyToManyElement
[
'fetch'
]);
}
if
(
isset
(
$manyToManyElement
[
'mappedBy'
]))
{
if
(
isset
(
$manyToManyElement
[
'mappedBy'
]))
{
$mapping
[
'mappedBy'
]
=
$manyToManyElement
[
'mappedBy'
];
$mapping
[
'mappedBy'
]
=
$manyToManyElement
[
'mappedBy'
];
}
else
if
(
isset
(
$manyToManyElement
[
'joinTable'
]))
{
}
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