Skip to content

Commit

Permalink
DDC-645 - Demoted <change-tracking-policy /> to an attribute on <enti…
Browse files Browse the repository at this point in the history
…ty /> to allow better validation, fixed XSD schema
  • Loading branch information
beberlei committed Aug 8, 2010
1 parent 251247c commit bd28cb1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
8 changes: 8 additions & 0 deletions UPGRADE_TO_2_0
@@ -1,3 +1,11 @@
# Update from 2.0-BETA3 to 2.0-BETA4

## XML Driver <change-tracking-policy /> element demoted to attribute

We changed how the XML Driver allows to define the change-tracking-policy. The working case is now:

<entity change-tracking-policy="DEFERRED_IMPLICT" />

# Update from 2.0-BETA2 to 2.0-BETA3

## Serialization of Uninitialized Proxies
Expand Down
9 changes: 9 additions & 0 deletions doctrine-mapping.xsd
Expand Up @@ -75,13 +75,22 @@
<xs:attribute name="schema" type="xs:NMTOKEN" />
<xs:attribute name="repository-class" type="xs:NMTOKEN"/>
<xs:attribute name="inheritance-type" type="orm:inheritance-type"/>
<xs:attribute name="change-tracking-policy" type="orm:change-tracking-policy" />
</xs:complexType>

<xs:complexType name="mapped-superclass" >
<xs:complexContent>
<xs:extension base="orm:entity"/>
</xs:complexContent>
</xs:complexType>

<xs:simpleType name="change-tracking-policy">
<xs:restriction base="xs:token">
<xs:enumeration value="DEFERRED_IMPLICIT"/>
<xs:enumeration value="DEFERRED_EXPLICIT"/>
<xs:enumeration value="NOTIFY"/>
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="inheritance-type">
<xs:restriction base="xs:token">
Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
Expand Up @@ -99,9 +99,9 @@ public function loadMetadataForClass($className, ClassMetadataInfo $metadata)
}

// Evaluate <change-tracking-policy...>
if (isset($xmlRoot->{'change-tracking-policy'})) {
if (isset($xmlRoot['change-tracking-policy'])) {
$metadata->setChangeTrackingPolicy(constant('Doctrine\ORM\Mapping\ClassMetadata::CHANGETRACKING_'
. strtoupper((string)$xmlRoot->{'change-tracking-policy'})));
. strtoupper((string)$xmlRoot['change-tracking-policy'])));
}

// Evaluate <indexes...>
Expand Down

0 comments on commit bd28cb1

Please sign in to comment.