0
votes

I've a requirement in my custom extension where there are records, lets say which are projects saved in table name: tx_myextension_domain_model_projects and which are categorized using custom category table tx_myextension_domain_model_categories the relation which is mapped in model is m:n and saved in mm table tx_myextension_category_record_mm.

This is the TCA mapping for the category field:

products_category' => [
    'exclude' => true,
    'label' => 'Category Label',
    'config' => [
        'type' => 'select',
        'renderType' => 'selectTree',
        'foreign_table' => 'tx_myextension_domain_model_categories',
        'foreign_table_where' => 'ORDER BY tx_myextension_domain_model_categories.sorting',
        'MM' => 'tx_myextension_category_record_mm',
        'MM_match_fields' => [
            'tablenames' => 'tx_myextension_domain_model_projects',
        ],
        'MM_opposite_field' => 'items',
        'size' => 20,
        'treeConfig' => [
            'parentField' => 'parent',
            'appearance' => [
                'showHeader' => true,
                'expandAll' => true,
                'maxLevels' => 99,
            ],
        ],
    ],

],

So in one of my use cases I need to get the projects which are categorized with disabled and active categories.

For example this is the categories :

categories = [
    A => [
        A1 => [
            A1.2
        ]
        A2 => [
            A2.2
        ]
    ],
    B => [
        B1 => [
            B1.2
        ]
    ],

];

Lets say A1 is disabled/hidden record and I want to get the projects which are assigned to A1 and its child A1.2. Is there any possibilities to get the project records using TYPO3 Repository query.

Note: I couldn't disable the enable fields using $querySettings->setIgnoreEnableFields(true); because I don't want to disable it for the entire repository of category and also I need to disable it from the Project repository while query the project records. I hope my question is clear. Please let me know the solution for this.

Solution Currently I choosed: I used TYPO3 Connection Pool Query instead of repository query.

1
TYPO3 has some default that are applied to a query directly. I think you might have to configure the repository settings to change those defaults. You can find an overview here (old! maybe there is better resource somewhere): wiki.typo3.org/…. Once the defaults are "turned off", you can implement a query over "hidden" again in your own query.Robert Wildling
Also, maybe the Restriction Builder is of help: docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/Database/….Robert Wildling

1 Answers

0
votes

Why isnt $query->getQuerySettings()->setIgnoreEnableFields(true); an option for you? You can build the query exactly the way you need it like you would do with the Connection Pool.