Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
doctrinebot opened this issue May 6, 2010 · 4 comments
Assignees
Labels
Milestone

Comments

@doctrinebot
Copy link

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
Copy link
Author

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
Copy link
Author

Comment created by andyajadeh:

this is my table I imported. thanks.

@doctrinebot
Copy link
Author

Issue was closed with resolution "Fixed"

@doctrinebot doctrinebot added this to the 2.0-BETA2 milestone Dec 6, 2015
@doctrinebot doctrinebot added the Bug label Dec 7, 2015
@doctrinebot
Copy link
Author

Imported 1 attachments from Jira into https://gist.github.com/eb82bf9d148fbb5a3189

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants