Skip to content

Commit

Permalink
Fixed form query in image service (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
into-the-v0id authored Oct 7, 2021
1 parent 45bf656 commit ba8792b
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions Classes/Service/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,30 @@
->removeAll()
->add(GeneralUtility::makeInstance(DeletedRestriction::class))
->add(GeneralUtility::makeInstance(FrontendWorkspaceRestriction::class));
$statement = $queryBuilder

$statement = $queryBuilder
->select('pi_flexform')
->from('tt_content');

$result = $statement->andWhere(
$queryBuilder->expr()->andX(
$queryBuilder->expr()->eq(
'sys_language_uid',
$queryBuilder->createNamedParameter($sys_language_uid, PDO::PARAM_INT)
),
$queryBuilder->expr()->eq(
'pid',
$queryBuilder->createNamedParameter((int)$_GET['pid'], PDO::PARAM_INT)
),
$queryBuilder->expr()->eq(
'CType',
$queryBuilder->createNamedParameter('form_formframework', PDO::PARAM_STR)
)
))->execute()->fetch();

if (empty($res)) {
$result = $statement->orWhere(
$result = $statement->andWhere(
$queryBuilder->expr()->andX(
$queryBuilder->expr()->eq(
'sys_language_uid',
$queryBuilder->createNamedParameter($sys_language_uid, PDO::PARAM_INT)
),
$queryBuilder->expr()->eq(
'pid',
$queryBuilder->createNamedParameter((int)$_GET['pid'], PDO::PARAM_INT)
),
$queryBuilder->expr()->eq(
'CType',
$queryBuilder->createNamedParameter('form_formframework', PDO::PARAM_STR)
)
)
)->execute()->fetch();

if (empty($result)) {
$result = $statement->orWhere(
$queryBuilder->expr()->andX(
$queryBuilder->expr()->eq(
'sys_language_uid',
Expand All @@ -65,10 +66,9 @@
'CType',
$queryBuilder->createNamedParameter('form_formframework', PDO::PARAM_STR)
)
))->execute()->fetch();;
}
$result = $statement->fetch();

)
)->execute()->fetch();
}

if ($result === false) {
throw MissingFormElement::make('Unable to find a form element for the given pid: ' . (int)$_GET['pid']);
Expand Down

0 comments on commit ba8792b

Please sign in to comment.