DDC-247: can't set "nullable" using xml mapping #305

Closed
opened 2026-01-22 12:33:58 +01:00 by admin · 6 comments
Owner

Originally created by @doctrinebot on GitHub (Jan 10, 2010).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user koubas:

nullable="TRUE" doesn't work in xml - all fields are always "not null" and JoinColumns are allways nullable

Originally created by @doctrinebot on GitHub (Jan 10, 2010). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user koubas: nullable="TRUE" doesn't work in xml - all fields are always "not null" and JoinColumns are allways nullable
admin added the Bug label 2026-01-22 12:33:59 +01:00
admin closed this issue 2026-01-22 12:34:00 +01:00
Author
Owner

@doctrinebot commented on GitHub (Jan 10, 2010):

@doctrinebot commented on GitHub (Jan 10, 2010): - is referenced by [DDC-282: Evaluate use of (bool) in XML-Driver](http://www.doctrine-project.org/jira/browse/DDC-282)
Author
Owner

@doctrinebot commented on GitHub (Jan 27, 2010):

Comment created by @beberlei:

Fixed

@doctrinebot commented on GitHub (Jan 27, 2010): Comment created by @beberlei: Fixed
Author
Owner

@doctrinebot commented on GitHub (Feb 3, 2010):

Comment created by ignat:

There is still no ability to create "NOT NULL" foreign key or I don't get it? I mean when you use join column declaration only?
For example

<entity ... >
  ...
  <one-to-one field="module" target-entity="Some\App\Entity\Module">
    <join-column name="module_id" referenced-column-name="id" nullable="false"  on-delete="cascade"/>
  </one-to-one>
  ...
</entity>

This will generate SQL with module_id column without "NOT NULL"
A looked to Doctrine\ORM\Tools\SchemaTool::_gatherRelationJoinColumns and added in my local version

$columnOptions = array('notnull' => false, 'columnDefinition' => $columnDef);
if (isset($joinColumn['nullable'])) {
  $columnOptions['notnull'] = !$joinColumn['nullable'];
}
@doctrinebot commented on GitHub (Feb 3, 2010): Comment created by ignat: There is still no ability to create "NOT NULL" foreign key or I don't get it? I mean when you use join column declaration only? For example ``` <entity ... > ... <one-to-one field="module" target-entity="Some\App\Entity\Module"> <join-column name="module_id" referenced-column-name="id" nullable="false" on-delete="cascade"/> </one-to-one> ... </entity> ``` This will generate SQL with module_id column without "NOT NULL" A looked to Doctrine\ORM\Tools\SchemaTool::_gatherRelationJoinColumns and added in my local version ``` $columnOptions = array('notnull' => false, 'columnDefinition' => $columnDef); if (isset($joinColumn['nullable'])) { $columnOptions['notnull'] = !$joinColumn['nullable']; } ```
Author
Owner

@doctrinebot commented on GitHub (Feb 3, 2010):

Comment created by @beberlei:

I missed that one, i thought SchemaTool supports the @JoinCOlumn nullable and only the XML Driver did not. The XML Driver did indeed not support this and this was added, however with the feature generally missing in SchemaTool this bugfix is indeed useless :-)

I get on it.

@doctrinebot commented on GitHub (Feb 3, 2010): Comment created by @beberlei: I missed that one, i thought SchemaTool supports the @JoinCOlumn nullable and only the XML Driver did not. The XML Driver did indeed not support this and this was added, however with the feature generally missing in SchemaTool this bugfix is indeed useless :-) I get on it.
Author
Owner

@doctrinebot commented on GitHub (Feb 7, 2010):

Comment created by @beberlei:

Fixed in trunk.

@doctrinebot commented on GitHub (Feb 7, 2010): Comment created by @beberlei: Fixed in trunk.
Author
Owner

@doctrinebot commented on GitHub (Feb 7, 2010):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Feb 7, 2010): Issue was closed with resolution "Fixed"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#305