Uploaded image for project: 'Doctrine 1'
  1. Doctrine 1
  2. DC-838

"Primary columns are implied to be notnull in Doctrine" but are not


    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Environment:
      Latest doctrine git commit: bfa24eb68640c412ff6115103ba044bbe1b4333b
      Ubuntu 10.4 x64
      MySQL server 5.1.41-3ubuntu12.6
      PHP 5.3.2


      Doctrine says : "Primary columns are implied to be notnull in Doctrine" (line 563 in lib/Doctrine/Import/Builder.php)

      But when generating (My)SQL statements, primary fields are not set to "NOT NULL" even if it is specified in the YAML and/or Model file.

      If doctrine unsets the 'notnull' option on line 565 in lib/Doctrine/Import/Builder.php (as it does), it should make sure to add the "NOT NULL" to the SQL when appropriate :

      • in getNotNullFieldDeclaration() method (line 798) in lib/Doctrine/Export.php
      • in getDeclaration() method (line 272) in lib/Doctrine/Export/Mysql.php

      Solution #1: In both places, check if field is primary, and if so, add "NOT NULL" to SQL, since "Primary columns are implied to be notnull in Doctrine".

      Solution #2: Change Doctrine as to not enforce this behaviour (eg. remove the check in lib/Doctrine/Import/Builder.php on line 565)

      Thx for this great ORM.

      ~ Jonathan


        There are no comments yet on this issue.


          • Assignee:
            jwage Jonathan H. Wage
            jonathan.dh Jonathan Melnick (Doghouse Media)
          • Votes:
            0 Vote for this issue
            1 Start watching this issue


            • Created: