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
4918d3e1
Commit
4918d3e1
authored
Oct 25, 2009
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0] Simplification and fix to cascades.
parent
08694d18
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
10 deletions
+23
-10
AssociationMapping.php
lib/Doctrine/ORM/Mapping/AssociationMapping.php
+15
-8
AnnotationExporter.php
lib/Doctrine/ORM/Tools/Export/Driver/AnnotationExporter.php
+8
-2
No files found.
lib/Doctrine/ORM/Mapping/AssociationMapping.php
View file @
4918d3e1
...
...
@@ -51,7 +51,6 @@ abstract class AssociationMapping
*/
const
FETCH_EAGER
=
3
;
public
$cascades
=
array
();
public
$isCascadeRemove
;
public
$isCascadePersist
;
public
$isCascadeRefresh
;
...
...
@@ -165,13 +164,12 @@ abstract class AssociationMapping
// Optional attributes for both sides
$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
);
$this
->
isCascadePersist
=
in_array
(
'persist'
,
$this
->
cascades
);
$this
->
isCascadeRefresh
=
in_array
(
'refresh'
,
$this
->
cascades
);
$this
->
isCascadeMerge
=
in_array
(
'merge'
,
$this
->
cascades
);
$this
->
isCascadeDetach
=
in_array
(
'detach'
,
$this
->
cascades
);
$cascades
=
isset
(
$mapping
[
'cascade'
])
?
$mapping
[
'cascade'
]
:
array
();
$this
->
isCascadeRemove
=
in_array
(
'remove'
,
$cascades
);
$this
->
isCascadePersist
=
in_array
(
'persist'
,
$cascades
);
$this
->
isCascadeRefresh
=
in_array
(
'refresh'
,
$cascades
);
$this
->
isCascadeMerge
=
in_array
(
'merge'
,
$cascades
);
$this
->
isCascadeDetach
=
in_array
(
'detach'
,
$cascades
);
}
/**
...
...
@@ -361,6 +359,15 @@ abstract class AssociationMapping
return
(
bool
)
$this
->
joinTable
;
}
public
function
hasCascades
()
{
return
$this
->
isCascadePersist
||
$this
->
isCascadeRemove
||
$this
->
isCascadeRefresh
||
$this
->
isCascadeMerge
||
$this
->
isCascadeDetach
;
}
/**
* Loads data in $target domain object using this association.
* The data comes from the association navigated from $sourceEntity
...
...
lib/Doctrine/ORM/Tools/Export/Driver/AnnotationExporter.php
View file @
4918d3e1
...
...
@@ -331,8 +331,14 @@ class AnnotationExporter extends AbstractExporter
if
(
isset
(
$associationMapping
->
mappedByFieldName
))
{
$typeOptions
[]
=
'mappedBy="'
.
$associationMapping
->
mappedByFieldName
.
'"'
;
}
if
(
isset
(
$associationMapping
->
cascades
)
&&
$associationMapping
->
cascades
)
{
$typeOptions
[]
=
'cascade={"'
.
implode
(
'"'
,
$associationMapping
->
cascades
)
.
'"}'
;
if
(
$associationMapping
->
hasCascades
())
{
$cascades
=
array
();
if
(
$this
->
isCascadePersist
)
$cascades
[]
=
'"persist"'
;
if
(
$this
->
isCascadeRemove
)
$cascades
[]
=
'"remove"'
;
if
(
$this
->
isCascadeDetach
)
$cascades
[]
=
'"detach"'
;
if
(
$this
->
isCascadeMerge
)
$cascades
[]
=
'"merge"'
;
if
(
$this
->
isCascadeRefresh
)
$cascades
[]
=
'"refresh"'
;
$typeOptions
[]
=
'cascade={'
.
implode
(
','
,
$cascades
)
.
'}'
;
}
if
(
isset
(
$associationMapping
->
orphanRemoval
)
&&
$associationMapping
->
orphanRemoval
)
{
$typeOptions
[]
=
'orphanRemoval='
.
(
$associationMapping
->
orphanRemoval
?
'true'
:
'false'
);
...
...
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