Skip to content

DDC-215: not null is not working using YAML #2839

Closed
doctrinebot opened this Issue Dec 16, 2009 · 1 comment

1 participant

@doctrinebot

Jira issue originally created by user hgirardi:

I've created this:

Test:
type: entity
table: test
fields:
id:
type: integer
id: true
generator:
strategy: auto
sequenceGenerator:
sequenceName: testidseq
allocationSize: 1
initialValue: 1
nome:
type: string
length: 300
sigla:
type: string
length: 5
notnull: false

result:
CREATE TABLE test (id INT NOT NULL, nome TEXT NOT NULL, sigla VARCHAR(5) DEFAULT NOT NULL, PRIMARY KEY(id))
CREATE SEQUENCE testidseq INCREMENT BY 1 START 1

I debuged doctrine's code and saw in the
lib/Doctrine/ORM/Tools/SchemaTool.php on _gatherColumn method
that is tested
$column['notnull'] = isset($mapping['nullable']) ? ! $mapping['nullable'] : true;
on line 266

but in lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php there's not any check for 'nullable', just 'notnull'...
on line 193 there's this validation:
if (isset($fieldMapping['notnull'])) {;
$mapping['notnull'] = $fieldMapping['notnull'];
}

if I insert this validation:
if (isset($fieldMapping['nullable'])) {;
$mapping['nullable'] = $fieldMapping['nullable'];
}

it's gonna work just fine...

@doctrinebot

Issue was closed with resolution "Fixed"

@doctrinebot doctrinebot added this to the 2.0-ALPHA4 milestone Dec 6, 2015
@doctrinebot doctrinebot closed this Dec 6, 2015
@doctrinebot doctrinebot added the Bug label Dec 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.