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
8523648a
Commit
8523648a
authored
Aug 25, 2009
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0] Fixed lifecycle callback mapping.
parent
356887c8
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
18 deletions
+20
-18
doctrine-mapping.xsd
doctrine-mapping.xsd
+5
-5
XmlDriver.php
lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
+5
-5
YamlDriver.php
lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
+4
-4
Doctrine.Tests.ORM.Mapping.User.dcm.xml
...s/ORM/Mapping/xml/Doctrine.Tests.ORM.Mapping.User.dcm.xml
+5
-3
Doctrine.Tests.ORM.Mapping.User.dcm.yml
.../ORM/Mapping/yaml/Doctrine.Tests.ORM.Mapping.User.dcm.yml
+1
-1
No files found.
doctrine-mapping.xsd
View file @
8523648a
...
...
@@ -33,7 +33,7 @@
</xs:sequence>
</xs:complexType>
<xs:simpleType
name=
"lifecycle-
listener
-type"
>
<xs:simpleType
name=
"lifecycle-
callback
-type"
>
<xs:restriction
base=
"xs:token"
>
<xs:enumeration
value=
"prePersist"
/>
<xs:enumeration
value=
"postPersist"
/>
...
...
@@ -45,14 +45,14 @@
</xs:restriction>
</xs:simpleType>
<xs:complexType
name=
"lifecycle-
listener
"
>
<xs:attribute
name=
"type"
type=
"orm:lifecycle-
listener
-type"
use=
"required"
/>
<xs:complexType
name=
"lifecycle-
callback
"
>
<xs:attribute
name=
"type"
type=
"orm:lifecycle-
callback
-type"
use=
"required"
/>
<xs:attribute
name=
"method"
type=
"xs:NMTOKEN"
use=
"required"
/>
</xs:complexType>
<xs:complexType
name=
"lifecycle-
listener
"
>
<xs:complexType
name=
"lifecycle-
callbacks
"
>
<xs:sequence>
<xs:element
name=
"lifecycle-
listener"
type=
"orm:lifecycle-listener
"
minOccurs=
"1"
maxOccurs=
"unbounded"
/>
<xs:element
name=
"lifecycle-
callback"
type=
"orm:lifecycle-callback
"
minOccurs=
"1"
maxOccurs=
"unbounded"
/>
</xs:sequence>
</xs:complexType>
...
...
lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
View file @
8523648a
...
...
@@ -275,12 +275,12 @@ class XmlDriver extends AbstractFileDriver
}
}
// Evaluate <lifecycle-
listener
...>
if
(
isset
(
$xmlRoot
->
{
'lifecycle-
listener
'
}))
{
foreach
(
$xmlRoot
->
{
'lifecycle-
listener'
}
as
$lifecycleListener
)
{
$method
=
$class
->
getMethod
((
string
)
$lifecycle
Listener
[
'method'
]);
// Evaluate <lifecycle-
callbacks
...>
if
(
isset
(
$xmlRoot
->
{
'lifecycle-
callbacks
'
}))
{
foreach
(
$xmlRoot
->
{
'lifecycle-
callbacks'
}
->
{
'lifecycle-callback'
}
as
$lifecycleCallback
)
{
$method
=
$class
->
getMethod
((
string
)
$lifecycle
Callback
[
'method'
]);
if
(
$method
->
isPublic
())
{
$metadata
->
addLifecycleCallback
(
$method
->
getName
(),
constant
(
'\Doctrine\ORM\Events::'
.
(
string
)
$lifecycle
Listener
[
'type'
]));
$metadata
->
addLifecycleCallback
(
$method
->
getName
(),
constant
(
'\Doctrine\ORM\Events::'
.
(
string
)
$lifecycle
Callback
[
'type'
]));
}
}
}
...
...
lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
View file @
8523648a
...
...
@@ -266,12 +266,12 @@ class YamlDriver extends AbstractFileDriver
}
}
// Evaluate lifeCycle
Listener
if
(
isset
(
$element
[
'lifecycle
Listener
s'
]))
{
foreach
(
$element
[
'lifecycle
Listener
s'
]
as
$method
=>
$type
)
{
// Evaluate lifeCycle
Callbacks
if
(
isset
(
$element
[
'lifecycle
Callback
s'
]))
{
foreach
(
$element
[
'lifecycle
Callback
s'
]
as
$method
=>
$type
)
{
$method
=
$class
->
getMethod
(
$method
);
if
(
$method
->
isPublic
())
{
$metadata
->
addLifecycleCallback
(
$method
->
getName
(),
constant
(
'\Doctrine\ORM\Events::'
.
$type
));
$metadata
->
addLifecycleCallback
(
$method
->
getName
(),
constant
(
'\Doctrine\ORM\Events::'
.
$type
));
}
}
}
...
...
tests/Doctrine/Tests/ORM/Mapping/xml/Doctrine.Tests.ORM.Mapping.User.dcm.xml
View file @
8523648a
...
...
@@ -6,9 +6,11 @@
/Users/robo/dev/php/Doctrine/doctrine-mapping.xsd"
>
<entity
name=
"Doctrine\Tests\ORM\Mapping\User"
table=
"cms_users"
>
<lifecycle-listener
method=
"doStuffOnPrePersist"
type=
"prePersist"
/>
<lifecycle-listener
method=
"doStuffOnPostPersist"
type=
"postPersist"
/>
<lifecycle-callbacks>
<lifecycle-callback
type=
"prePersist"
method=
"doStuffOnPrePersist"
/>
<lifecycle-callback
type=
"postPersist"
method=
"doStuffOnPostPersist"
/>
</lifecycle-callbacks>
<id
name=
"id"
type=
"integer"
column=
"id"
>
<generator
strategy=
"AUTO"
/>
...
...
tests/Doctrine/Tests/ORM/Mapping/yaml/Doctrine.Tests.ORM.Mapping.User.dcm.yml
View file @
8523648a
...
...
@@ -32,6 +32,6 @@ Doctrine\Tests\ORM\Mapping\User:
inverseJoinColumns
:
group_id
:
referencedColumnName
:
id
lifecycle
Listener
s
:
lifecycle
Callback
s
:
doStuffOnPrePersist
:
prePersist
doStuffOnPostPersist
:
postPersist
\ 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