Properly generate default value from yml & xml mapping
This commit is contained in:
parent
ce41e35c1f
commit
ac9a5e69ec
@ -1312,7 +1312,7 @@ public function __construct(<params>)
|
||||
|
||||
$lines[] = $this->generateFieldMappingPropertyDocBlock($fieldMapping, $metadata);
|
||||
$lines[] = $this->spaces . $this->fieldVisibility . ' $' . $fieldMapping['fieldName']
|
||||
. (isset($fieldMapping['default']) ? ' = ' . var_export($fieldMapping['default'], true) : null) . ";\n";
|
||||
. (isset($fieldMapping['options']['default']) ? ' = ' . var_export($fieldMapping['options']['default'], true) : null) . ";\n";
|
||||
}
|
||||
|
||||
return implode("\n", $lines);
|
||||
|
@ -64,7 +64,7 @@ class EntityGeneratorTest extends OrmTestCase
|
||||
$metadata->table['uniqueConstraints']['name_uniq'] = array('columns' => array('name'));
|
||||
$metadata->table['indexes']['status_idx'] = array('columns' => array('status'));
|
||||
$metadata->mapField(array('fieldName' => 'name', 'type' => 'string'));
|
||||
$metadata->mapField(array('fieldName' => 'status', 'type' => 'string', 'default' => 'published'));
|
||||
$metadata->mapField(array('fieldName' => 'status', 'type' => 'string', 'options' => array('default' => 'published')));
|
||||
$metadata->mapField(array('fieldName' => 'id', 'type' => 'integer', 'id' => true));
|
||||
$metadata->mapOneToOne(array('fieldName' => 'author', 'targetEntity' => 'Doctrine\Tests\ORM\Tools\EntityGeneratorAuthor', 'mappedBy' => 'book'));
|
||||
$joinColumns = array(
|
||||
|
Loading…
Reference in New Issue
Block a user