Project

General

Profile

Actions

Bug #50383

open

Extbase doesn't support TCA ctrl type based of a related record

Added by Daniel Ostmann over 11 years ago. Updated over 9 years ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2013-07-24
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.1
PHP Version:
5.4
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

I wanted to add a new field (simple textarea) to the sys_file_reference. I wrote a module that subclasses TYPO3\CMS\Extbase\Domain\Model\FileReference and the new model provides the new field. All seems to work in backend.

In frontend i get this SQL Error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':type='2') AND sys_file_reference.deleted=0 AND sys_file_reference.t3ver_state<=' at line 1: SELECT sys_file_reference.* FROM sys_file_reference WHERE ((sys_file_reference.uid_foreign = '14' AND sys_file_reference.tablenames = 'tt_content') AND sys_file_reference.fieldname = 'pxf_teaser_images') AND (sys_file_reference.uid_local:type='2') AND sys_file_reference.deleted=0 AND sys_file_reference.t3ver_state<=0 AND sys_file_reference.pid<>-1 AND sys_file_reference.hidden=0 ORDER BY sys_file_reference.sorting_foreign ASC

Taking a closer look you'll see that the where clause, that checks for "uid_local:type" causes the error:

AND (sys_file_reference.uid_local:type='2') AND

In TCA of the sys_file_reference there is a field

'type' => 'uid_local:type',

So i think this value isn't resolved in frontend?

I fixed it by just removing "(sys_file_reference.uid_local:type='2')" from the whereclause, in:

\TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend::buildQuery()

    public function buildQuery(array $sql) {
        foreach ($sql['additionalWhereClause'] as $key => $clause) {
            if ($clause == "(sys_file_reference.uid_local:type='2')") unset($sql['additionalWhereClause'][$key]);
        }

Well, this is not the final solution of course. It just helped me solving the problem. That's why i didn't provide a patch yet. I just don't know how to solve it...


Files

patch_commit_119fc407b7d7.patch (3.58 KB) patch_commit_119fc407b7d7.patch Daniel Ostmann, 2013-07-29 13:59
Actions

Also available in: Atom PDF