Project

General

Profile

Actions

Bug #105954

closed

Extbase persistence cannot be used without a runtime server request

Added by Alexander Schnitzler about 1 month ago. Updated 18 days ago.

Status:
Resolved
Priority:
Should have
Category:
Extbase
Start date:
2025-01-17
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
13
PHP Version:
8.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Extbase persistence uses the configuration manager to retrieve two different config values. Storage page id and whether reference index should be updated. Since the configuration manager needs a frontend request (introduced in 13.x), Extbase persistence breaks in areas where it worked before such as the command line. Users had to use query settings explicitly to define the storage page id, but that's just fine.

It's desired to get the old behavior back in TYPO3 13.


Related issues 2 (1 open1 closed)

Related to TYPO3 Core - Task #106041: Always update refindex in extbaseResolved2025-01-31

Actions
Is duplicate of TYPO3 Core - Bug #105554: Enable Extbase to be used in console commandsAccepted2024-11-07

Actions
Actions #1

Updated by Gerrit Code Review about 1 month ago

  • Status changed from New to Under Review

Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/87784

Actions #2

Updated by Gerrit Code Review about 1 month ago

Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/87784

Actions #3

Updated by Gerrit Code Review about 1 month ago

Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/87784

Actions #4

Updated by Nikita Hovratov 24 days ago

  • Is duplicate of Bug #105554: Enable Extbase to be used in console commands added
Actions #5

Updated by Christian Kuhn 19 days ago · Edited

I agree we should relax this for the given parameters, but I disagree with "the dependency to request is a regression" phrasing: Many things within the extbase framework are request driven. We only made this fact more explicit since v12 to avoid extbase behaving funny since both request and TypoScript are a crucial dependency of extbase, which is why running extbase for instance as early middleware (before TS has been calculated) is not a clever design decisions. Core says here: Sorry, up to you, if you still decide to do that, you then have to bootstrap on your own.

Making the dependency to TS and request more clear within extbase is not a regression. If this should go away, then find a way to make the ConfigurationManager not depend on TS anymore (plus the impact on TranslationService, Repository config, ...). I failed on this for years now and only mitigated many negative side effects and made this very unfortunate dependency more clear.

The reason I'm still upvoting the patch is that especially the updateRefindex toggle needs to be removed from extbase anyway, and it really does not harm much when we introduce a reasonable fallback for storagePid along the way. So the patch itself is fine with me, I only don't agree with the reasoning stated in the issue.

Actions #6

Updated by Alexander Schnitzler 18 days ago

Making the dependency to TS and request more clear within extbase is not a regression.

Sure, technically that's not a regression and that's not the issue here. Binding the Configuration Manager to the request makes sense. The persistence having a hard dependency to the ConfigurationManager and as of 13.4 to the Request, that's the regression and issue. One we can easily solve in the future as stated in a private chat.

To actual customers, this is a regression, no matter the technical terms and details here. The real world project dudes have to assess the impact of TYPO3 upgrades and their cost and encountering those issues is a bummer. It will delay the acceptance of 13.4.

For a long time I had the same opinion. Extbase isn't made for all this low level stuff. Well, I was wrong. When using Domain Driven Design, it's crucial to rely on your domain to alter data. Reads aren't that important but bypassing writes, breaks the concept of DDD. Unless your entities are just objects representing a database row. But that's not DDD. If there is business logic in your entities, you want to use those, even in low level stuff like imports.

Actions #7

Updated by Garvin Hicking 18 days ago · Edited

I want to use this opportunity for a small soapbox. 😇

I believe extbase's ORM is a great TYPO3 framework offering, especially for casual developers. Without it, TYPO3 would have much less usage in web agencies. Coupling this low-barrier framework with a CMS is a distinction feature, compared to pure frameworks like symfony/laravel.

I (personally) firmly think we need to make extbase work "as frictionless" as possible for a good DX. I think it would be great if we can improve the possibilities to utilize extbase ORM (repositories, entities, persistence) safely in more places like CLI and backend tasks.

Current progress in decoupling things more, and setting boundaries might prove beneficial for this.

Maybe we can leverage more site settings / context attributes to "configure" the lowlevel domain model / storage access, independently from a request and typoscript. Using the SiteFinder/SiteAPI and allowing to easily fetch settings could open this up? Or even using that to provide a stub request along to typoscript.

Allowing an easy API to "bootstrap TS with a fake request" (like https://gitlab.com/reelworx/typo3/t3-fakefrontend or https://github.com/undkonsorten/extbase-cli-aware-configuration-manager) might help here, so in CLI/backend people could just say "API::bootstrapExtbasePersistence($siteId)" and then being able to access repositories, getters, and ideally even localization. We could throw exceptions at places where this is not possible and see where the pain points will show up, and if these can be "sealed off".

Then, the basic need for people to:

- retrieve an extbase model by repository methods
- create a fresh extbase model
- persist and delete extbase models
- execute extbase querybuilder methods
- execute "getter" / business logic

could be covered. Using the ActionController part outside of a "real" request IMO is (from what I've read usually) not even asked for.

I also understand some people dislike extbase for being "oppinionated" or enforce too simple design/architecture, and where they rather use "pure" controllers, custom DBAL handling, DataHandler or custom persistence. That's all fine, and everyone preferring this can continue to do that. But those that like extbase for the ease of use it provides, they should have the easiest API possibilities to use it in all common aspects of TYPO3 (frontend, backend, cli).

Just some thoughts. (Sidenote, wouldn't call this a regression myself, but a needed alignment/scoping that might even prove beneficial to setting the new boundaries and circumstances which parts of extbase can be accessed.)

Tl;dr Requiring to use native DBAL calls and duplicating access logic to allow CLI/BE usage is not a good DX experience; going that way would force people into not using extbase logic at all to prevent redundancy - in which case other frameworks would perform better. I think we can strengthen TYPO3 to be recommendable for framework-y tasks there.

Actions #8

Updated by Gerrit Code Review 18 days ago

Patch set 5 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/87784

Actions #9

Updated by Gerrit Code Review 18 days ago

Patch set 1 for branch 13.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/87928

Actions #10

Updated by Gerrit Code Review 18 days ago

Patch set 2 for branch 13.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/87928

Actions #11

Updated by Anonymous 18 days ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #12

Updated by Christian Kuhn 16 days ago

  • Related to Task #106041: Always update refindex in extbase added
Actions

Also available in: Atom PDF