fix DDC-1642
This commit is contained in:
parent
600d0ba2a2
commit
86054eb659
@ -1152,9 +1152,10 @@ class BasicEntityPersister
|
||||
foreach ($columns AS $column) {
|
||||
$placeholder = '?';
|
||||
|
||||
if (isset($this->_columnTypes[$column]) &&
|
||||
if (isset($this->_class->fieldNames[$column]) &&
|
||||
isset($this->_columnTypes[$this->_class->fieldNames[$column]]) &&
|
||||
isset($this->_class->fieldMappings[$this->_class->fieldNames[$column]]['requireSQLConversion'])) {
|
||||
$type = Type::getType($this->_columnTypes[$column]);
|
||||
$type = Type::getType($this->_columnTypes[$this->_class->fieldNames[$column]]);
|
||||
$placeholder = $type->convertToDatabaseValueSQL('?', $this->_platform);
|
||||
}
|
||||
|
||||
|
@ -18,4 +18,9 @@ class CustomTypeUpperCase
|
||||
* @Column(type="upper_case_string")
|
||||
*/
|
||||
public $lowerCaseString;
|
||||
|
||||
/**
|
||||
* @Column(type="upper_case_string", name="named_lower_case_string", nullable = true)
|
||||
*/
|
||||
public $namedLowerCaseString;
|
||||
}
|
||||
|
@ -47,6 +47,43 @@ class TypeValueSqlTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
$this->assertEquals('FOO', $this->_em->getConnection()->fetchColumn("select lowerCaseString from customtype_uppercases where id=".$entity->id.""), 'Database holds uppercase string');
|
||||
}
|
||||
|
||||
/**
|
||||
* @group DDC-1642
|
||||
*/
|
||||
public function testUpperCaseStringTypeWhenColumnNameIsDefined()
|
||||
{
|
||||
|
||||
$entity = new CustomTypeUpperCase();
|
||||
$entity->lowerCaseString = 'Some Value';
|
||||
$entity->namedLowerCaseString = 'foo';
|
||||
|
||||
$this->_em->persist($entity);
|
||||
$this->_em->flush();
|
||||
|
||||
$id = $entity->id;
|
||||
|
||||
$this->_em->clear();
|
||||
|
||||
$entity = $this->_em->find('\Doctrine\Tests\Models\CustomType\CustomTypeUpperCase', $id);
|
||||
$this->assertEquals('foo', $entity->namedLowerCaseString, 'Entity holds lowercase string');
|
||||
$this->assertEquals('FOO', $this->_em->getConnection()->fetchColumn("select named_lower_case_string from customtype_uppercases where id=".$entity->id.""), 'Database holds uppercase string');
|
||||
|
||||
|
||||
$entity->namedLowerCaseString = 'bar';
|
||||
|
||||
$this->_em->persist($entity);
|
||||
$this->_em->flush();
|
||||
|
||||
$id = $entity->id;
|
||||
|
||||
$this->_em->clear();
|
||||
|
||||
|
||||
$entity = $this->_em->find('\Doctrine\Tests\Models\CustomType\CustomTypeUpperCase', $id);
|
||||
$this->assertEquals('bar', $entity->namedLowerCaseString, 'Entity holds lowercase string');
|
||||
$this->assertEquals('BAR', $this->_em->getConnection()->fetchColumn("select named_lower_case_string from customtype_uppercases where id=".$entity->id.""), 'Database holds uppercase string');
|
||||
}
|
||||
|
||||
public function testTypeValueSqlWithAssociations()
|
||||
{
|
||||
$parent = new CustomTypeParent();
|
||||
|
Loading…
x
Reference in New Issue
Block a user