Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

yaml driver

  • Loading branch information...
commit f0b04375de5faca43788d29650ac05ec4bb69210 1 parent 917aa70
@FabioBatSilva authored fabio.silva committed
View
11 lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
@@ -572,6 +572,17 @@ public function loadMetadataForClass($className, ClassMetadata $metadata)
}
}
}
+
+ // Evaluate entityListeners
+ if (isset($element['entityListeners'])) {
+ foreach ($element['entityListeners'] as $className => $entityListener) {
+ foreach ($entityListener as $eventName => $callbackElement){
+ foreach ($callbackElement as $methodName){
+ $metadata->addEntityListener($eventName, $className, $methodName);
+ }
+ }
+ }
+ }
}
/**
View
6 tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php
@@ -759,7 +759,8 @@ public function testAttributeOverridesMapping()
public function testEntityListeners()
{
if ( ! ($this instanceof AnnotationDriverTest)
- && ! ($this instanceof XmlMappingDriverTest)) {
+ && ! ($this instanceof XmlMappingDriverTest)
+ && ! ($this instanceof YamlMappingDriverTest)) {
$this->markTestIncomplete();
}
@@ -818,7 +819,8 @@ public function testEntityListeners()
public function testCallEntityListeners()
{
if ( ! ($this instanceof AnnotationDriverTest)
- && ! ($this instanceof XmlMappingDriverTest)) {
+ && ! ($this instanceof XmlMappingDriverTest)
+ && ! ($this instanceof YamlMappingDriverTest)) {
$this->markTestIncomplete();
}
View
2  tests/Doctrine/Tests/ORM/Mapping/xml/Doctrine.Tests.Models.Company.CompanyContract.dcm.xml
@@ -21,7 +21,7 @@
<post-persist method="postPersistHandler"/>
<pre-persist method="prePersistHandler"/>
- <post-update method="postPersistHandler"/>
+ <post-update method="postUpdateHandler"/>
<pre-update method="preUpdateHandler"/>
<post-remove method="postRemoveHandler"/>
View
2  ...rine/Tests/ORM/Mapping/xml/Doctrine.Tests.Models.Company.CompanyFlexUltraContract.dcm.xml
@@ -15,7 +15,7 @@
<post-persist method="postPersistHandler"/>
<pre-persist method="prePersistHandler"/>
- <post-update method="postPersistHandler"/>
+ <post-update method="postUpdateHandler"/>
<pre-update method="preUpdateHandler"/>
<post-remove method="postRemoveHandler"/>
View
30 tests/Doctrine/Tests/ORM/Mapping/yaml/Doctrine.Tests.Models.Company.CompanyContract.dcm.yml
@@ -0,0 +1,30 @@
+Doctrine\Tests\Models\Company\CompanyContract:
+ type: entity
+ table: company_contracts
+ inheritanceType: SINGLE_TABLE
+ discriminatorMap:
+ fix: CompanyFixContract
+ flexible: CompanyFlexContract
+ flexultra: CompanyFlexUltraContract
+ entityListeners:
+ ContractSubscriber:
+ preFlush: [preFlushHandler]
+ postLoad: [postLoadHandler]
+
+ postPersist: [postPersistHandler]
+ prePersist: [prePersistHandler]
+
+ postUpdate: [postUpdateHandler]
+ preUpdate: [preUpdateHandler]
+
+ postRemove: [postRemoveHandler]
+ preRemove: [preRemoveHandler]
+
+ id:
+ id:
+ type: integer
+ generator:
+ strategy: AUTO
+ fields:
+ completed:
+ type: boolean
View
5 .../Doctrine/Tests/ORM/Mapping/yaml/Doctrine.Tests.Models.Company.CompanyFixContract.dcm.yml
@@ -0,0 +1,5 @@
+Doctrine\Tests\Models\Company\CompanyFixContract:
+ type: entity
+ fields:
+ fixPrice:
+ type: integer
View
7 ...Doctrine/Tests/ORM/Mapping/yaml/Doctrine.Tests.Models.Company.CompanyFlexContract.dcm.yml
@@ -0,0 +1,7 @@
+Doctrine\Tests\Models\Company\CompanyFlexContract:
+ type: entity
+ fields:
+ hoursWorked:
+ type: integer
+ pricePerHour:
+ type: integer
View
22 ...ine/Tests/ORM/Mapping/yaml/Doctrine.Tests.Models.Company.CompanyFlexUltraContract.dcm.yml
@@ -0,0 +1,22 @@
+Doctrine\Tests\Models\Company\CompanyFlexUltraContract:
+ type: entity
+ entityListeners:
+ ContractSubscriber:
+ preFlush: [preFlushHandler]
+ postLoad: [postLoadHandler]
+
+ postPersist: [postPersistHandler]
+ prePersist: [prePersistHandler]
+
+ postUpdate: [postUpdateHandler]
+ preUpdate: [preUpdateHandler]
+
+ postRemove: [postRemoveHandler]
+ preRemove: [preRemoveHandler]
+
+ FlexUltraContractSubscriber:
+ prePersist: [prePersistHandler1, prePersistHandler2]
+
+ fields:
+ maxPrice:
+ type: integer
Please sign in to comment.
Something went wrong with that request. Please try again.