DDC-574: PHP Mapping Driver generates notnull => false, instead of nullable => true #5080

Closed
doctrinebot opened this Issue May 6, 2010 · 4 comments

2 participants

@doctrinebot

Jira issue originally created by user andyajadeh:

I tried to import a schema from postgresql database, to a php file mapping.
I had created that database using doctrine schema tool with annotation mapping.

to import it, I used:

php doctrine orm:convert-mapping --from-database php ./php

and I got something like:

<?php

use Doctrine\ORM\Mapping\ClassMetadataInfo;

$metadata->setInheritanceType(ClassMetadataInfo::INHERITANCE*TYPE*NONE);
$metadata->setPrimaryTable(array(
   'name' => 'mdp',
  ));
$metadata->setChangeTrackingPolicy(ClassMetadataInfo::CHANGETRACKING*DEFERRED*IMPLICIT);
$metadata->mapField(array(
   'id' => true,
   'fieldName' => 'id',
   'columnName' => 'id',
   'type' => 'integer',
  ));
$metadata->mapField(array(
   'fieldName' => 'rrn',
   'columnName' => 'rrn',
   'type' => 'string',
   'length' => 50,
   'fixed' => false,
   'notnull' => false,
  ));

$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR*TYPE*SEQUENCE);

When I try to drop & create the database using this php mapping, the "notnull => false" doesn't work.
The column definition in the database is still NOT NULL. But when I add "nullable => true", it works like I expected (DEFAULT NULL::character varying)

@doctrinebot

Comment created by shurakai:

Hi Andy,

do you think you could add such a .sql testfile for us? I will look into this shortly afterwards.

Thanks for helping!

@doctrinebot

Comment created by andyajadeh:

this is my table I imported. thanks.

@doctrinebot

Issue was closed with resolution "Fixed"

@jwage jwage was assigned by doctrinebot Dec 6, 2015
@doctrinebot doctrinebot added this to the 2.0-BETA2 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