Skip to content

Commit

Permalink
Merge pull request #9 from webcoast-dk/master
Browse files Browse the repository at this point in the history
[BUGFIX] Template error and incorrect language handling
  • Loading branch information
Sven Wappler authored Mar 24, 2019
2 parents a803fdf + 780d732 commit 1c820e6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Classes/Domain/Repository/GlossaryRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
namespace SveWap\A21glossary\Domain\Repository;

use SveWap\A21glossary\Domain\Model\Glossary;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException;
use TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory;
use TYPO3\CMS\Extbase\Persistence\Generic\Query;
use TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser;
use TYPO3\CMS\Extbase\Persistence\QueryInterface;
use TYPO3\CMS\Extbase\Persistence\QueryResultInterface;
use TYPO3\CMS\Extbase\Persistence\Repository;
Expand All @@ -25,9 +23,13 @@ public function findAllForIndex()
{
/** @var Query $query */
$query = $this->createQuery();
$tableName = $this->objectManager->get(DataMapFactory::class)->buildDataMap($this->objectType)->getTableName();
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($tableName);
$queryBuilder->selectLiteral('substr(' . $queryBuilder->quoteIdentifier('short') . ', 1, 1) AS ' . $queryBuilder->quoteIdentifier('char'))->from($tableName)->groupBy('char');
// Get the query parser via object manager to use dependency injection
$parser = $this->objectManager->get(Typo3DbQueryParser::class);
// Convert the extbase query to a query builder
$queryBuilder = $parser->convertQueryToDoctrineQueryBuilder($query);
// Add our select and group by
$queryBuilder->selectLiteral('substr(' . $queryBuilder->quoteIdentifier('short') . ', 1, 1) AS ' . $queryBuilder->quoteIdentifier('char'))
->groupBy('char');

return $query->statement($queryBuilder)->execute(true);
}
Expand Down
6 changes: 6 additions & 0 deletions Configuration/TCA/tx_a21glossary_main.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@
'type' => 'select',
'renderType' => 'selectSingle',
'special' => 'languages',
'items' => [
[
'LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.allLanguages',
-1,
],
]
]
],
'l18n_parent' => [
Expand Down

0 comments on commit 1c820e6

Please sign in to comment.