Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move partial index into the typo3 database #138

Draft
wants to merge 17 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[TASK] Drop model
fseipel committed Jul 24, 2024
commit 1d70b863939393e8e729089cd78f95e3db13c488
74 changes: 0 additions & 74 deletions Classes/Domain/Model/Update.php

This file was deleted.

46 changes: 31 additions & 15 deletions Classes/Domain/Repository/UpdateRepository.php
Original file line number Diff line number Diff line change
@@ -7,26 +7,13 @@

use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings;
use TYPO3\CMS\Extbase\Persistence\Repository;

class UpdateRepository extends Repository
final class UpdateRepository
{
private const TABLE_NAME = 'tx_searchable_domain_model_update';

private ConnectionPool $connectionPool;

public function injectConnectionPool(ConnectionPool $connectionPool): void
{
$this->connectionPool = $connectionPool;
}

public function initializeObject(): void
public function __construct(private readonly ConnectionPool $connectionPool)
{
$querySettings = GeneralUtility::makeInstance(Typo3QuerySettings::class);
$querySettings->setRespectStoragePage(false);
$this->setDefaultQuerySettings($querySettings);
}

public function insertUpdate(
@@ -50,6 +37,35 @@ public function insertUpdate(
}
}

public function findAll(): array
{
$queryBuilder = $this->connectionPool
->getConnectionForTable(self::TABLE_NAME)
->createQueryBuilder();

$queryBuilder
->select('*')
->from(self::TABLE_NAME);

return $queryBuilder->executeQuery()->fetchAllAssociative();
}

public function findByType(string $type): array
{
$queryBuilder = $this->connectionPool
->getConnectionForTable(self::TABLE_NAME)
->createQueryBuilder();

$queryBuilder
->select('*')
->from(self::TABLE_NAME)
->where(
$queryBuilder->expr()->eq('type', $queryBuilder->createNamedParameter($type, \PDO::PARAM_STR)),
);

return $queryBuilder->executeQuery()->fetchAllAssociative();
}

public function deleteAll()
{
foreach ($this->findAll() as $object) {
8 changes: 4 additions & 4 deletions Classes/Query/UpdateQuery.php
Original file line number Diff line number Diff line change
@@ -64,14 +64,14 @@ public function getUpdates($index, $type)

$updateParams = [];

foreach ($results as $hit) {
foreach ($results as $update) {
//If this is a simple toplevel uid check, we can add this id directly to the updated uid list
if ($hit->getProperty() == 'uid') {
$recordids[$hit->getPropertyUid()] = $hit->getPropertyUid();
if ($update['property'] == 'uid') {
$recordids[$update['property_uid']] = $update['property_uid'];
} else {
$updateParams[] = [
"term" => [
$hit->getProperty() => $hit->getPropertyUid(),
$update['property'] => $update['property_uid'],
],
];
}
3 changes: 3 additions & 0 deletions Configuration/Services.yaml
Original file line number Diff line number Diff line change
@@ -37,5 +37,8 @@ services:
PAGEmachine\Searchable\Service\IndexingService:
public: true

PAGEmachine\Searchable\Domain\Repository\UpdateRepository:
public: true

PAGEmachine\Searchable\DataCollector\TCA\FormDataRecord:
autowire: false
55 changes: 0 additions & 55 deletions Configuration/TCA/tx_searchable_domain_model_update.php

This file was deleted.

2 changes: 1 addition & 1 deletion Resources/Private/Templates/Backend/Start.html
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@ <h2>Update schedule</h2>
<tr>
<td>{update.type}</td>
<td>{update.property}</td>
<td>{update.propertyUid}</td>
<td>{update.property_uid}</td>
</tr>
</f:for>