Skip to content

Commit

Permalink
PostgreSQL do not support alias in update queries (ezsystems#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
vidarl committed Oct 2, 2018
1 parent cb94776 commit 8d7906a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
18 changes: 9 additions & 9 deletions bundle/Command/ConvertXmlTextToRichTextCommand.php
Expand Up @@ -368,13 +368,13 @@ protected function convertFieldDefinitions($dryRun, OutputInterface $output)
$output->writeln("Found $count field definiton to convert.");

$updateQuery = $this->dbal->createQueryBuilder();
$updateQuery->update('ezcontentclass_attribute', 'a')
->set('a.data_type_string', ':newdatatypestring')
$updateQuery->update('ezcontentclass_attribute')
->set('data_type_string', ':newdatatypestring')
// was tagPreset in ezxmltext, unused in RichText
->set('a.data_text2', ':datatext2')
->set('data_text2', ':datatext2')
->where(
$updateQuery->expr()->eq(
'a.data_type_string',
'data_type_string',
':olddatatypestring'
)
)
Expand Down Expand Up @@ -462,18 +462,18 @@ protected function getFieldRows($datatypeString, $contentId, $offset, $limit)
protected function updateFieldRow($dryRun, $id, $version, $datatext)
{
$updateQuery = $this->dbal->createQueryBuilder();
$updateQuery->update('ezcontentobject_attribute', 'a')
->set('a.data_type_string', ':datatypestring')
->set('a.data_text', ':datatext')
$updateQuery->update('ezcontentobject_attribute')
->set('data_type_string', ':datatypestring')
->set('data_text', ':datatext')
->where(
$updateQuery->expr()->eq(
'a.id',
'id',
':id'
)
)
->andWhere(
$updateQuery->expr()->eq(
'a.version',
'version',
':version'
)
)
Expand Down
10 changes: 5 additions & 5 deletions bundle/Command/ImportXmlCommand.php
Expand Up @@ -261,23 +261,23 @@ protected function contentObjectAttributeExists($objectId, $attributeId, $versio
protected function updateContentObjectAttribute($xml, $objectId, $attributeId, $version, $language)
{
$updateQuery = $this->dbal->createQueryBuilder();
$updateQuery->update('ezcontentobject_attribute', 'a')
->set('a.data_text', ':newxml')
$updateQuery->update('ezcontentobject_attribute')
->set('data_text', ':newxml')
->where(
$updateQuery->expr()->eq(
'a.data_type_string',
'data_type_string',
':datatypestring'
)
)
->andWhere(
$updateQuery->expr()->eq(
'a.contentobject_id',
'contentobject_id',
':objectid'
)
)
->andWhere(
$updateQuery->expr()->eq(
'a.id',
'id',
':attributeid'
)
)
Expand Down

0 comments on commit 8d7906a

Please sign in to comment.