Merge branch 'DDC-2732'
This commit is contained in:
commit
2feffe164a
@ -364,6 +364,7 @@
|
|||||||
<xs:element name="generator" type="orm:generator" minOccurs="0" />
|
<xs:element name="generator" type="orm:generator" minOccurs="0" />
|
||||||
<xs:element name="sequence-generator" type="orm:sequence-generator" minOccurs="0" maxOccurs="1" />
|
<xs:element name="sequence-generator" type="orm:sequence-generator" minOccurs="0" maxOccurs="1" />
|
||||||
<xs:element name="custom-id-generator" type="orm:custom-id-generator" minOccurs="0" maxOccurs="1" />
|
<xs:element name="custom-id-generator" type="orm:custom-id-generator" minOccurs="0" maxOccurs="1" />
|
||||||
|
<xs:element name="options" type="orm:options" minOccurs="0" />
|
||||||
<xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other"/>
|
<xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other"/>
|
||||||
</xs:sequence>
|
</xs:sequence>
|
||||||
<xs:attribute name="name" type="xs:NMTOKEN" use="required" />
|
<xs:attribute name="name" type="xs:NMTOKEN" use="required" />
|
||||||
|
@ -283,6 +283,10 @@ class XmlDriver extends FileDriver
|
|||||||
$mapping['columnDefinition'] = (string)$idElement['column-definition'];
|
$mapping['columnDefinition'] = (string)$idElement['column-definition'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($idElement->options)) {
|
||||||
|
$mapping['options'] = $this->_parseOptions($idElement->options->children());
|
||||||
|
}
|
||||||
|
|
||||||
$metadata->mapField($mapping);
|
$metadata->mapField($mapping);
|
||||||
|
|
||||||
if (isset($idElement->generator)) {
|
if (isset($idElement->generator)) {
|
||||||
|
@ -187,12 +187,32 @@ abstract class AbstractMappingDriverTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
$this->assertTrue($class->fieldMappings['name']['nullable']);
|
$this->assertTrue($class->fieldMappings['name']['nullable']);
|
||||||
$this->assertTrue($class->fieldMappings['name']['unique']);
|
$this->assertTrue($class->fieldMappings['name']['unique']);
|
||||||
|
|
||||||
|
return $class;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @depends testEntityTableNameAndInheritance
|
||||||
|
* @param ClassMetadata $class
|
||||||
|
*/
|
||||||
|
public function testFieldOptions($class)
|
||||||
|
{
|
||||||
$expected = array('foo' => 'bar', 'baz' => array('key' => 'val'));
|
$expected = array('foo' => 'bar', 'baz' => array('key' => 'val'));
|
||||||
$this->assertEquals($expected, $class->fieldMappings['name']['options']);
|
$this->assertEquals($expected, $class->fieldMappings['name']['options']);
|
||||||
|
|
||||||
return $class;
|
return $class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @depends testEntityTableNameAndInheritance
|
||||||
|
* @param ClassMetadata $class
|
||||||
|
*/
|
||||||
|
public function testIdFieldOptions($class)
|
||||||
|
{
|
||||||
|
$this->assertEquals(array('foo' => 'bar'), $class->fieldMappings['id']['options']);
|
||||||
|
|
||||||
|
return $class;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @depends testFieldMappings
|
* @depends testFieldMappings
|
||||||
* @param ClassMetadata $class
|
* @param ClassMetadata $class
|
||||||
@ -918,7 +938,7 @@ class User
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @Id
|
* @Id
|
||||||
* @Column(type="integer")
|
* @Column(type="integer", options={"foo": "bar"})
|
||||||
* @generatedValue(strategy="AUTO")
|
* @generatedValue(strategy="AUTO")
|
||||||
* @SequenceGenerator(sequenceName="tablename_seq", initialValue=1, allocationSize=100)
|
* @SequenceGenerator(sequenceName="tablename_seq", initialValue=1, allocationSize=100)
|
||||||
**/
|
**/
|
||||||
@ -999,6 +1019,7 @@ class User
|
|||||||
'fieldName' => 'id',
|
'fieldName' => 'id',
|
||||||
'type' => 'integer',
|
'type' => 'integer',
|
||||||
'columnName' => 'id',
|
'columnName' => 'id',
|
||||||
|
'options' => array('foo' => 'bar'),
|
||||||
));
|
));
|
||||||
$metadata->mapField(array(
|
$metadata->mapField(array(
|
||||||
'fieldName' => 'name',
|
'fieldName' => 'name',
|
||||||
|
@ -19,6 +19,7 @@ $metadata->mapField(array(
|
|||||||
'fieldName' => 'id',
|
'fieldName' => 'id',
|
||||||
'type' => 'integer',
|
'type' => 'integer',
|
||||||
'columnName' => 'id',
|
'columnName' => 'id',
|
||||||
|
'options' => array('foo' => 'bar'),
|
||||||
));
|
));
|
||||||
$metadata->mapField(array(
|
$metadata->mapField(array(
|
||||||
'fieldName' => 'name',
|
'fieldName' => 'name',
|
||||||
|
@ -35,6 +35,9 @@
|
|||||||
<id name="id" type="integer" column="id">
|
<id name="id" type="integer" column="id">
|
||||||
<generator strategy="AUTO"/>
|
<generator strategy="AUTO"/>
|
||||||
<sequence-generator sequence-name="tablename_seq" allocation-size="100" initial-value="1" />
|
<sequence-generator sequence-name="tablename_seq" allocation-size="100" initial-value="1" />
|
||||||
|
<options>
|
||||||
|
<option name="foo">bar</option>
|
||||||
|
</options>
|
||||||
</id>
|
</id>
|
||||||
|
|
||||||
<field name="name" column="name" type="string" length="50" nullable="true" unique="true">
|
<field name="name" column="name" type="string" length="50" nullable="true" unique="true">
|
||||||
|
@ -16,6 +16,8 @@ Doctrine\Tests\ORM\Mapping\User:
|
|||||||
sequenceName: tablename_seq
|
sequenceName: tablename_seq
|
||||||
allocationSize: 100
|
allocationSize: 100
|
||||||
initialValue: 1
|
initialValue: 1
|
||||||
|
options:
|
||||||
|
foo: bar
|
||||||
fields:
|
fields:
|
||||||
name:
|
name:
|
||||||
type: string
|
type: string
|
||||||
|
Loading…
x
Reference in New Issue
Block a user