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
ae6e597d
Commit
ae6e597d
authored
Feb 10, 2010
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0][DDC-311] Fixed.
parent
04832e27
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
2 deletions
+34
-2
ClassMetadataFactory.php
lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php
+1
-0
ClassMetadataInfo.php
lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
+11
-0
LifecycleCallbackTest.php
...s/Doctrine/Tests/ORM/Functional/LifecycleCallbackTest.php
+22
-2
No files found.
lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php
View file @
ae6e597d
...
@@ -219,6 +219,7 @@ class ClassMetadataFactory
...
@@ -219,6 +219,7 @@ class ClassMetadataFactory
$class
->
setVersioned
(
$parent
->
isVersioned
);
$class
->
setVersioned
(
$parent
->
isVersioned
);
$class
->
setVersionField
(
$parent
->
versionField
);
$class
->
setVersionField
(
$parent
->
versionField
);
$class
->
setDiscriminatorMap
(
$parent
->
discriminatorMap
);
$class
->
setDiscriminatorMap
(
$parent
->
discriminatorMap
);
$class
->
setLifecycleCallbacks
(
$parent
->
lifecycleCallbacks
);
}
}
// Invoke driver
// Invoke driver
...
...
lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
View file @
ae6e597d
...
@@ -1371,6 +1371,17 @@ class ClassMetadataInfo
...
@@ -1371,6 +1371,17 @@ class ClassMetadataInfo
{
{
$this
->
lifecycleCallbacks
[
$event
][]
=
$callback
;
$this
->
lifecycleCallbacks
[
$event
][]
=
$callback
;
}
}
/**
* Sets the lifecycle callbacks for entities of this class.
* Any previously registered callbacks are overwritten.
*
* @param array $callbacks
*/
public
function
setLifecycleCallbacks
(
array
$callbacks
)
{
$this
->
lifecycleCallbacks
=
$callbacks
;
}
/**
/**
* Sets the discriminator column definition.
* Sets the discriminator column definition.
...
...
tests/Doctrine/Tests/ORM/Functional/LifecycleCallbackTest.php
View file @
ae6e597d
...
@@ -105,11 +105,17 @@ class LifecycleCallbackTest extends \Doctrine\Tests\OrmFunctionalTestCase
...
@@ -105,11 +105,17 @@ class LifecycleCallbackTest extends \Doctrine\Tests\OrmFunctionalTestCase
$this
->
assertTrue
(
$e1
->
prePersistCallbackInvoked
);
$this
->
assertTrue
(
$e1
->
prePersistCallbackInvoked
);
$this
->
assertTrue
(
$e2
->
prePersistCallbackInvoked
);
$this
->
assertTrue
(
$e2
->
prePersistCallbackInvoked
);
}
}
public
function
testLifecycleCallbacksGetInherited
()
{
$childMeta
=
$this
->
_em
->
getClassMetadata
(
__NAMESPACE__
.
'\LifecycleCallbackChildEntity'
);
$this
->
assertEquals
(
array
(
'prePersist'
=>
array
(
0
=>
'doStuff'
)),
$childMeta
->
lifecycleCallbacks
);
}
}
}
/** @Entity @HasLifecycleCallbacks */
/** @Entity @HasLifecycleCallbacks */
class
LifecycleCallbackTestUser
{
class
LifecycleCallbackTestUser
{
/** @Id @Column(type="integer") @GeneratedValue
(strategy="AUTO")
*/
/** @Id @Column(type="integer") @GeneratedValue */
private
$id
;
private
$id
;
/** @Column(type="string") */
/** @Column(type="string") */
private
$value
;
private
$value
;
...
@@ -198,4 +204,18 @@ class LifecycleCallbackCascader
...
@@ -198,4 +204,18 @@ class LifecycleCallbackCascader
{
{
$this
->
entities
=
new
\Doctrine\Common\Collections\ArrayCollection
();
$this
->
entities
=
new
\Doctrine\Common\Collections\ArrayCollection
();
}
}
}
}
\ No newline at end of file
/** @MappedSuperclass @HasLifecycleCallbacks */
class
LifecycleCallbackParentEntity
{
/** @PrePersist */
function
doStuff
()
{
}
}
/** @Entity @Table(name="lc_cb_childentity") */
class
LifecycleCallbackChildEntity
extends
LifecycleCallbackParentEntity
{
/** @Id @Column(type="integer") @GeneratedValue */
private
$id
;
}
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