Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update error with wizard MigrateMediaToAssetsForTextMediaCe #13

Open
Oktopuce opened this issue Oct 22, 2024 · 0 comments
Open

Update error with wizard MigrateMediaToAssetsForTextMediaCe #13

Oktopuce opened this issue Oct 22, 2024 · 0 comments

Comments

@Oktopuce
Copy link

The wizard MigrateMediaToAssetsForTextMediaCe tries to update the new database field for extension "fluid_styled_content" with this request:

$connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable('sys_file_reference');
$updateQueryBuilder = $connection->createQueryBuilder();
$updateQueryBuilder->update('sys_file_reference')
    ->leftJoin('sys_file_reference','tt_content','tt_content')
    ->where(
        $updateQueryBuilder->expr()->and(
            $updateQueryBuilder->expr()->eq(
                'tt_content.CType', $updateQueryBuilder->createNamedParameter('textmedia', \PDO::PARAM_STR)
            ),
            $updateQueryBuilder->expr()->gt('media', $updateQueryBuilder->createNamedParameter(0, \PDO::PARAM_INT)),
        )
    )->set('tt_content.assets', 'tt_content.media', false)
    ->set('sys_file_reference.fieldname', 'assets')
    ->set('tt_content.media', 0)
->executeStatement();

but this can't work, join condition are not supported by doctrine/dbal because the join method is not supported in all db engines for delete or update.

And this result whit a query like this:

UPDATE `sys_file_reference`
SET `tt_content`.`assets`            = tt_content.media,
    `sys_file_reference`.`fieldname` = ?,
    `tt_content`.`media`             = ?
WHERE ((`tt_content`.`CType` = ?) AND (`media` > ?));

and the error:

(1/3) #1054 Doctrine\DBAL\Exception\InvalidFieldNameException
An exception occurred while executing a query: Unknown column 'tt_content.CType' in 'where clause'

The solution is to make a select query and then update the database.

And there is also an error with join because there is no join condition between sys_file_reference and tt_content, the join should have been like this:

->leftJoin(
    'sys_file_reference','tt_content','tt_content',
    $queryBuilder->expr()->eq('sys_file_reference.uid_foreign', $queryBuilder->quoteIdentifier('tt_content.uid'))
)
Oktopuce pushed a commit to Oktopuce/core_upgrader-issue-11 that referenced this issue Oct 22, 2024
Oktopuce pushed a commit to Oktopuce/core_upgrader-issue-11 that referenced this issue Oct 22, 2024
Oktopuce pushed a commit to Oktopuce/core_upgrader-issue-11 that referenced this issue Oct 22, 2024
Oktopuce pushed a commit to Oktopuce/core_upgrader-issue-11 that referenced this issue Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant