Side-by-Side

Still not believing, that this Extension could completely change the way you have been working on Typo3 projects up until now?

Let’s have a look at some of the everyday tasks you have been implementing over and over again. Compare not only the number of code-lines involved in getting the job done – but also the brain-energy needed to memorize the steps, methods and parameters required in the direct comparison.

Also pay attention to how the main concept of building links in the backend context has changed from Version 8 to 9. Sure: Things have definately gotten better. But think of the time you would have spent to find this solution and update it in all of you extensions.

Then look at the nnhelpers one-liner on the right side. See the difference between building links in the frontend or backend context? Any difference in building the links from version 8 LTS to 9 LTS?

I think you understand, what we are talking about.

Getting the TypoScript Setup outside of the Controller

Task: You need to get the demo.path value from the TypoScript setup of a plugin, but you are not in a context where you could simply do a $this->settings to retrieve it.

Standard Typo3

use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManager;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;

$objectManager = GeneralUtility::makeInstance( ObjectManager::class );
$configurationManager = $objectManager->get( ConfigurationManager::class );
$settings = $configurationManager->getConfiguration( ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS, null, 'tx_my_ext');
$value = $settings['demo']['path'] ?? '';

WITH nnhelpers

$value = \nn\t3::Settings()->get('my_ext_table', 'demo.path');

Retrieving data from a table

Task: Get one row of raw data from the database table by its uid.

Standard Typo3

use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Utility\GeneralUtility;

$queryBuilder = GeneralUtility::makeInstance( ConnectionPool::class )
   ->getQueryBuilderForTable( 'my_ext_table' )
   ->select('*')
   ->from( 'my_ext_table' );
$queryBuilder->andWhere(
   $queryBuilder->expr()->eq( 'uid', $queryBuilder->createNamedParameter( 99 ))
);
$row = $queryBuilder->execute()->fetch();

WITH nnhelpers

\nn\t3::Db()->findByUid('my_ext_table', 99);

Retrieving data from a table

Task: Get the raw data of a database table and ignore the hidden field and start/endtime restrictions i.e. to simply export it as CSV or iterate through it.

Standard Typo3

use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Database\Query\Restriction;

$queryBuilder = GeneralUtility::makeInstance( ConnectionPool::class )
   ->getQueryBuilderForTable( 'my_ext_table' )
   ->select('*')
   ->from( 'my_ext_table' );
$restrictions = $queryBuilder->getRestrictions();
$restrictions->removeByType( StartTimeRestriction::class );
$restrictions->removeByType( EndTimeRestriction::class );
$restrictions->removeByType( HiddenRestriction::class );

$rows = $queryBuilder->execute()->fetchAll();

WITH nnhelpers

\nn\t3::Db()->findAll('my_ext_table', true);