TYPO3-Documentation/TYPO3CMS-Book-ExtbaseFluid

Chapter on individual database queries mixes Extbase and core persistence

sypets opened this issue · 0 comments

On page https://docs.typo3.org/typo3cms/ExtbaseFluidBook/6-Persistence/3-implement-individual-database-queries.html#individual-database-queries

In the warning in, the code example uses the core QueryBuilder and not Extbase Query.

Warning
You should always avoid making queries to the persistence layer outside of the domain model. Encapsulate these queries always in a repository.
Inside of the repositories, you can access the database using a database connection:
EXT:my_extension/Classes/Domain/Repository/MyRepository.php
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Utility\GeneralUtility;
$connection = GeneralUtility::makeInstance(ConnectionPool::class)
->getConnectionForTable('tx_sjroffers_domain_model_offer');

But right after the warning, it warns about the "Extbase" execute() method (where in the previous code snippet, it is not Extbase):

Since Extbase 1.2 (TYPO3 4.4), the method execute() returns a multidimensional array

This is at least slightly confusing, and it might be a good idea to add that we are using core persistence and why.

Also, I am not sure why we have this warning. Additionally, it seems out of place in the section on "Orderings in the query".