1
0
mirror of synced 2025-03-22 16:03:49 +03:00

Merge pull request #820 from apancutt/master

Added support for field options to FieldBuilder
This commit is contained in:
Benjamin Eberlei 2014-01-03 14:03:25 -08:00
commit 69cad4079d
2 changed files with 21 additions and 0 deletions

View File

@ -153,6 +153,20 @@ class FieldBuilder
return $this;
}
/**
* Sets an option.
*
* @param string $name
* @param mixed $value
*
* @return FieldBuilder
*/
public function option($name, $value)
{
$this->mapping['options'][$name] = $value;
return $this;
}
/**
* @param string $strategy
*

View File

@ -174,6 +174,13 @@ class ClassMetadataBuilderTest extends \Doctrine\Tests\OrmTestCase
$this->assertEquals(array('columnName' => 'id', 'fieldName' => 'id', 'id' => true, 'type' => 'integer'), $this->cm->fieldMappings['id']);
}
public function testCreateUnsignedOptionField()
{
$this->builder->createField('state', 'integer')->option('unsigned', true)->build();
$this->assertEquals(array('fieldName' => 'state', 'type' => 'integer', 'options' => array('unsigned' => true), 'columnName' => 'state'), $this->cm->fieldMappings['state']);
}
public function testAddLifecycleEvent()
{
$this->builder->addLifecycleEvent('getStatus', 'postLoad');