mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-215: not null is not working using YAML #268
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Dec 16, 2009).
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: test_id_seq
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 test_id_seq 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 commented on GitHub (Dec 19, 2009):
Issue was closed with resolution "Fixed"