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
1d60c65d
Commit
1d60c65d
authored
Mar 17, 2010
by
jwage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0] Adding test to ensure onDelete and onUpdate are read properly from all mapping drivers
parent
9b596895
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
2 deletions
+19
-2
AbstractMappingDriverTest.php
.../Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php
+13
-0
Doctrine.Tests.ORM.Mapping.User.php
...Tests/ORM/Mapping/php/Doctrine.Tests.ORM.Mapping.User.php
+2
-0
Doctrine.Tests.ORM.Mapping.User.dcm.xml
...s/ORM/Mapping/xml/Doctrine.Tests.ORM.Mapping.User.dcm.xml
+1
-1
Doctrine.Tests.ORM.Mapping.User.dcm.yml
.../ORM/Mapping/yaml/Doctrine.Tests.ORM.Mapping.User.dcm.yml
+2
-0
User.php
tools/sandbox/Entities/User.php
+1
-1
No files found.
tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php
View file @
1d60c65d
...
...
@@ -189,6 +189,18 @@ abstract class AbstractMappingDriverTest extends \Doctrine\Tests\OrmTestCase
return
$class
;
}
/**
* @depends testColumnDefinition
* @param ClassMetadata $class
*/
public
function
testJoinColumnOnDeleteAndOnUpdate
(
$class
)
{
$this
->
assertEquals
(
'CASCADE'
,
$class
->
associationMappings
[
'address'
]
->
joinColumns
[
0
][
'onDelete'
]);
$this
->
assertEquals
(
'CASCADE'
,
$class
->
associationMappings
[
'address'
]
->
joinColumns
[
0
][
'onUpdate'
]);
return
$class
;
}
}
/**
...
...
@@ -213,6 +225,7 @@ class User
/**
* @OneToOne(targetEntity="Address", cascade={"remove"})
* @JoinColumn(onDelete="CASCADE", onUpdate="CASCADE")
*/
public
$address
;
...
...
tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.ORM.Mapping.User.php
View file @
1d60c65d
...
...
@@ -45,6 +45,8 @@ $metadata->mapOneToOne(array(
array
(
'name'
=>
'address_id'
,
'referencedColumnName'
=>
'id'
,
'onDelete'
=>
'CASCADE'
,
'onUpdate'
=>
'CASCADE'
),
),
'orphanRemoval'
=>
false
,
...
...
tests/Doctrine/Tests/ORM/Mapping/xml/Doctrine.Tests.ORM.Mapping.User.dcm.xml
View file @
1d60c65d
...
...
@@ -22,7 +22,7 @@
<one-to-one
field=
"address"
target-entity=
"Address"
>
<cascade><cascade-remove
/></cascade>
<join-column
name=
"address_id"
referenced-column-name=
"id"
/>
<join-column
name=
"address_id"
referenced-column-name=
"id"
on-delete=
"CASCADE"
on-update=
"CASCADE"
/>
</one-to-one>
<one-to-many
field=
"phonenumbers"
target-entity=
"Phonenumber"
mapped-by=
"user"
>
...
...
tests/Doctrine/Tests/ORM/Mapping/yaml/Doctrine.Tests.ORM.Mapping.User.dcm.yml
View file @
1d60c65d
...
...
@@ -22,6 +22,8 @@ Doctrine\Tests\ORM\Mapping\User:
joinColumn
:
name
:
address_id
referencedColumnName
:
id
onDelete
:
CASCADE
onUpdate
:
CASCADE
cascade
:
[
remove
]
oneToMany
:
phonenumbers
:
...
...
tools/sandbox/Entities/User.php
View file @
1d60c65d
...
...
@@ -45,4 +45,4 @@ class User
$address
->
setUser
(
$this
);
}
}
}
}
\ No newline at end of file
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