1
0
mirror of synced 2025-01-29 19:41:45 +03:00

DDC-525 - Single Table Inheritance fields of child entities ALWAYS have to be nullable, Schema-Tool now enforces this.

This commit is contained in:
Benjamin Eberlei 2010-09-27 23:22:52 +02:00
parent 84bd843eed
commit 394469d4b7
4 changed files with 7 additions and 4 deletions

View File

@ -299,6 +299,9 @@ class SchemaTool
$options = array(); $options = array();
$options['length'] = isset($mapping['length']) ? $mapping['length'] : null; $options['length'] = isset($mapping['length']) ? $mapping['length'] : null;
$options['notnull'] = isset($mapping['nullable']) ? ! $mapping['nullable'] : true; $options['notnull'] = isset($mapping['nullable']) ? ! $mapping['nullable'] : true;
if ($class->isInheritanceTypeSingleTable() && count($class->parentClasses) > 0) {
$options['notnull'] = false;
}
$options['platformOptions'] = array(); $options['platformOptions'] = array();
$options['platformOptions']['version'] = $class->isVersioned && $class->versionField == $mapping['fieldName'] ? true : false; $options['platformOptions']['version'] = $class->isVersioned && $class->versionField == $mapping['fieldName'] ? true : false;

View File

@ -8,7 +8,7 @@ namespace Doctrine\Tests\Models\Company;
class CompanyFixContract extends CompanyContract class CompanyFixContract extends CompanyContract
{ {
/** /**
* @column(type="integer", nullable=true) * @column(type="integer")
* @var int * @var int
*/ */
private $fixPrice = 0; private $fixPrice = 0;

View File

@ -7,13 +7,13 @@ namespace Doctrine\Tests\Models\Company;
class CompanyFlexContract extends CompanyContract class CompanyFlexContract extends CompanyContract
{ {
/** /**
* @column(type="integer", nullable=true) * @column(type="integer")
* @var int * @var int
*/ */
private $hoursWorked = 0; private $hoursWorked = 0;
/** /**
* @column(type="integer", nullable=true) * @column(type="integer")
* @var int * @var int
*/ */
private $pricePerHour = 0; private $pricePerHour = 0;

View File

@ -8,7 +8,7 @@ namespace Doctrine\Tests\Models\Company;
class CompanyFlexUltraContract extends CompanyFlexContract class CompanyFlexUltraContract extends CompanyFlexContract
{ {
/** /**
* @column(type="integer", nullable=true) * @column(type="integer")
* @var int * @var int
*/ */
private $maxPrice = 0; private $maxPrice = 0;