diff --git a/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php b/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
index 00de4f2ea..3d8499180 100644
--- a/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
+++ b/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
@@ -661,10 +661,13 @@ class XmlDriver extends FileDriver
$value = (string) $option;
}
- $attr = $option->attributes();
+ $attributes = $option->attributes();
- if (isset($attr->name)) {
- $array[(string) $attr->name] = $value;
+ if (isset($attributes->name)) {
+ $nameAttribute = (string) $attributes->name;
+ $array[$nameAttribute] = in_array($nameAttribute, ['unsigned', 'fixed'])
+ ? $this->evaluateBoolean($value)
+ : $value;
} else {
$array[] = $value;
}
diff --git a/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php b/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php
index 8d90931f9..c4fd1381d 100644
--- a/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php
+++ b/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php
@@ -210,11 +210,14 @@ abstract class AbstractMappingDriverTest extends OrmTestCase
/**
* @depends testEntityTableNameAndInheritance
+ *
* @param ClassMetadata $class
+ *
+ * @return ClassMetadata
*/
- public function testFieldOptions($class)
+ public function testFieldOptions(ClassMetadata $class)
{
- $expected = array('foo' => 'bar', 'baz' => array('key' => 'val'));
+ $expected = ['foo' => 'bar', 'baz' => ['key' => 'val'], 'fixed' => false];
$this->assertEquals($expected, $class->fieldMappings['name']['options']);
return $class;
@@ -226,7 +229,7 @@ abstract class AbstractMappingDriverTest extends OrmTestCase
*/
public function testIdFieldOptions($class)
{
- $this->assertEquals(array('foo' => 'bar'), $class->fieldMappings['id']['options']);
+ $this->assertEquals(['foo' => 'bar', 'unsigned' => false], $class->fieldMappings['id']['options']);
return $class;
}
@@ -244,6 +247,26 @@ abstract class AbstractMappingDriverTest extends OrmTestCase
return $class;
}
+ /**
+ * @group #6129
+ *
+ * @depends testLoadMapping
+ *
+ * @param ClassMetadata $class
+ *
+ * @return ClassMetadata
+ */
+ public function testBooleanValuesForOptionIsSetCorrectly(ClassMetadata $class)
+ {
+ $this->assertInternalType('bool', $class->fieldMappings['id']['options']['unsigned']);
+ $this->assertFalse($class->fieldMappings['id']['options']['unsigned']);
+
+ $this->assertInternalType('bool', $class->fieldMappings['name']['options']['fixed']);
+ $this->assertFalse($class->fieldMappings['name']['options']['fixed']);
+
+ return $class;
+ }
+
/**
* @depends testIdentifier
* @param ClassMetadata $class
@@ -1048,14 +1071,14 @@ class User
{
/**
* @Id
- * @Column(type="integer", options={"foo": "bar"})
+ * @Column(type="integer", options={"foo": "bar", "unsigned": false})
* @generatedValue(strategy="AUTO")
* @SequenceGenerator(sequenceName="tablename_seq", initialValue=1, allocationSize=100)
**/
public $id;
/**
- * @Column(length=50, nullable=true, unique=true, options={"foo": "bar", "baz": {"key": "val"}})
+ * @Column(length=50, nullable=true, unique=true, options={"foo": "bar", "baz": {"key": "val"}, "fixed": false})
*/
public $name;
@@ -1129,7 +1152,7 @@ class User
'fieldName' => 'id',
'type' => 'integer',
'columnName' => 'id',
- 'options' => array('foo' => 'bar'),
+ 'options' => array('foo' => 'bar', 'unsigned' => false),
));
$metadata->mapField(array(
'fieldName' => 'name',
@@ -1138,7 +1161,7 @@ class User
'unique' => true,
'nullable' => true,
'columnName' => 'name',
- 'options' => array('foo' => 'bar', 'baz' => array('key' => 'val')),
+ 'options' => array('foo' => 'bar', 'baz' => array('key' => 'val'), 'fixed' => false),
));
$metadata->mapField(array(
'fieldName' => 'email',
@@ -1474,4 +1497,4 @@ class SingleTableEntityIncompleteDiscriminatorColumnMapping
class SingleTableEntityIncompleteDiscriminatorColumnMappingSub1
extends SingleTableEntityIncompleteDiscriminatorColumnMapping {}
class SingleTableEntityIncompleteDiscriminatorColumnMappingSub2
- extends SingleTableEntityIncompleteDiscriminatorColumnMapping {}
\ No newline at end of file
+ extends SingleTableEntityIncompleteDiscriminatorColumnMapping {}
diff --git a/tests/Doctrine/Tests/ORM/Mapping/XmlMappingDriverTest.php b/tests/Doctrine/Tests/ORM/Mapping/XmlMappingDriverTest.php
index 735c16ed5..ae188057d 100644
--- a/tests/Doctrine/Tests/ORM/Mapping/XmlMappingDriverTest.php
+++ b/tests/Doctrine/Tests/ORM/Mapping/XmlMappingDriverTest.php
@@ -34,7 +34,7 @@ class XmlMappingDriverTest extends AbstractMappingDriverTest
}
/**
- * @expectedException Doctrine\ORM\Cache\CacheException
+ * @expectedException \Doctrine\ORM\Cache\CacheException
* @expectedExceptionMessage Entity association field "Doctrine\Tests\ORM\Mapping\XMLSLC#foo" not configured as part of the second-level cache.
*/
public function testFailingSecondLevelCacheAssociation()
@@ -132,7 +132,7 @@ class XmlMappingDriverTest extends AbstractMappingDriverTest
/**
* @group DDC-1468
*
- * @expectedException Doctrine\Common\Persistence\Mapping\MappingException
+ * @expectedException \Doctrine\Common\Persistence\Mapping\MappingException
* @expectedExceptionMessage Invalid mapping file 'Doctrine.Tests.Models.Generic.SerializationModel.dcm.xml' for class 'Doctrine\Tests\Models\Generic\SerializationModel'.
*/
public function testInvalidMappingFileException()
diff --git a/tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.ORM.Mapping.User.php b/tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.ORM.Mapping.User.php
index 67dbd752d..5bcc6d029 100644
--- a/tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.ORM.Mapping.User.php
+++ b/tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.ORM.Mapping.User.php
@@ -19,7 +19,7 @@ $metadata->mapField(array(
'fieldName' => 'id',
'type' => 'integer',
'columnName' => 'id',
- 'options' => array('foo' => 'bar'),
+ 'options' => array('foo' => 'bar', 'unsigned' => false),
));
$metadata->mapField(array(
'fieldName' => 'name',
@@ -28,7 +28,7 @@ $metadata->mapField(array(
'unique' => true,
'nullable' => true,
'columnName' => 'name',
- 'options' => array('foo' => 'bar', 'baz' => array('key' => 'val')),
+ 'options' => array('foo' => 'bar', 'baz' => array('key' => 'val'), 'fixed' => false),
));
$metadata->mapField(array(
'fieldName' => 'email',
diff --git a/tests/Doctrine/Tests/ORM/Mapping/xml/Doctrine.Tests.ORM.Mapping.User.dcm.xml b/tests/Doctrine/Tests/ORM/Mapping/xml/Doctrine.Tests.ORM.Mapping.User.dcm.xml
index 28b1e0571..bbf29aeaf 100644
--- a/tests/Doctrine/Tests/ORM/Mapping/xml/Doctrine.Tests.ORM.Mapping.User.dcm.xml
+++ b/tests/Doctrine/Tests/ORM/Mapping/xml/Doctrine.Tests.ORM.Mapping.User.dcm.xml
@@ -41,6 +41,7 @@
+
@@ -50,6 +51,7 @@
+
diff --git a/tests/Doctrine/Tests/ORM/Mapping/yaml/Doctrine.Tests.ORM.Mapping.User.dcm.yml b/tests/Doctrine/Tests/ORM/Mapping/yaml/Doctrine.Tests.ORM.Mapping.User.dcm.yml
index 457b24eea..e3a32ce76 100644
--- a/tests/Doctrine/Tests/ORM/Mapping/yaml/Doctrine.Tests.ORM.Mapping.User.dcm.yml
+++ b/tests/Doctrine/Tests/ORM/Mapping/yaml/Doctrine.Tests.ORM.Mapping.User.dcm.yml
@@ -18,6 +18,7 @@ Doctrine\Tests\ORM\Mapping\User:
initialValue: 1
options:
foo: bar
+ unsigned: false
fields:
name:
type: string
@@ -28,6 +29,7 @@ Doctrine\Tests\ORM\Mapping\User:
foo: bar
baz:
key: val
+ fixed: false
email:
type: string
column: user_email