---
title: "Deprecation: #102793 - PageRepository->enableFields"
manual: "TYPO3 Core Changelog"
version: "main"
permalink: "https://docs.typo3.org/permalink/changelog:deprecation-102793-1704798252"
source: "Changelog/13.0/Deprecation-102793-PageRepositoryEnableFields.rst"
typo3-version: "13.0"
typo3-major: 13
type: "deprecation"
issue: 102793
forge: "https://forge.typo3.org/issues/102793"
tags: ["Database", "Frontend", "PHP-API", "NotScanned", "ext:core"]
rendered: "2026-09-23T16:35:56+00:00"
---

# Deprecation: #102793 - PageRepository->enableFields {#deprecation-102793-1704798252}

See [forge#102793](https://forge.typo3.org/issues/102793)

## Description {#description}

One of the common PHP APIs used in TYPO3 Core for fetching records is
`\TYPO3\CMS\Core\Domain\Repository\PageRepository`. The method
`enableFields()` is used to enhance a database query with additional
restrictions such as filtering out versioned records from workspaces, hidden
database entries or scheduled database entries.

This method has been marked as deprecated in favor of a new method
`getDefaultConstraints()`.

## Impact {#impact}

Calling the method will trigger a PHP deprecation warning.

## Affected installations {#affected-installations}

TYPO3 installations with custom extensions using the method `enableFields()`
of the `PageRepository` class.

## Migration {#migration}

A new method called `getDefaultConstraints()` has been introduced
which supersedes the old method. The new method returns an array of
`CompositeExpression` objects, which can be used instead.

### Before (TYPO3 v12) {#before-typo3-v12}

```php
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
    ->getQueryBuilderForTable($tableName);

$constraints = GeneralUtility::makeInstance(PageRepository::class)
    ->enableFields($tableName);

$queryBuilder
    ->select('*')
    ->from($tableName);
    ->where(QueryHelper::stripLogicalOperatorPrefix($constraints);

$queryBuilder->execute();
```

### After (TYPO3 v13) {#after-typo3-v13}

```php
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
    ->getQueryBuilderForTable($tableName);

$constraints = GeneralUtility::makeInstance(PageRepository::class)
    ->getDefaultConstraints($tableName);

$queryBuilder
    ->select('*')
    ->from($tableName);

if ($constraints !== []) {
    $queryBuilder->where(...$constraints);
}

$queryBuilder->execute();
```
