Skip to content

BUGFIX: Standalone subscription store via Neos.ContentRepository.Dbal #5552

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

Open
wants to merge 6 commits into
base: 9.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions Neos.ContentGraph.DoctrineDbalAdapter/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
},
"require": {
"neos/contentrepository-core": "self.version",
"neos/contentrepository-dbal": "self.version",
"doctrine/dbal": "^3.1.4",
"doctrine/migrations": "*"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
use Neos\ContentRepository\Core\Feature\WorkspacePublication\Event\WorkspaceWasPublished;
use Neos\ContentRepository\Core\Feature\WorkspaceRebase\Event\WorkspaceRebaseFailed;
use Neos\ContentRepository\Core\Feature\WorkspaceRebase\Event\WorkspaceWasRebased;
use Neos\ContentRepository\Core\Infrastructure\DbalSchemaDiff;
use Neos\ContentRepository\Core\NodeType\NodeTypeName;
use Neos\ContentRepository\Core\Projection\ContentGraph\ContentGraphProjectionInterface;
use Neos\ContentRepository\Core\Projection\ContentGraph\ContentGraphReadModelInterface;
Expand All @@ -71,6 +70,7 @@
use Neos\ContentRepository\Core\SharedModel\Node\NodeName;
use Neos\ContentRepository\Core\SharedModel\Node\ReferenceName;
use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId;
use Neos\ContentRepository\Dbal\DbalSchemaDiff;
use Neos\EventStore\Model\EventEnvelope;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Exception as DBALException;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\Schema\Column;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Types\Types;
use Neos\ContentRepository\Core\Infrastructure\DbalSchemaFactory;
use Neos\ContentRepository\Dbal\DbalSchemaFactory;

/**
* @internal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@

use Doctrine\DBAL\ArrayParameterType;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\ParameterType;
use Doctrine\DBAL\Query\QueryBuilder;
use Neos\ContentGraph\DoctrineDbalAdapter\Domain\Projection\NodeRelationAnchorPoint;
use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint;
use Neos\ContentRepository\Core\Infrastructure\DbalSchemaFactory;
use Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindRootNodeAggregatesFilter;
use Neos\ContentRepository\Core\Projection\ContentGraph\Filter\NodeType\ExpandedNodeTypeCriteria;
use Neos\ContentRepository\Core\Projection\ContentGraph\Filter\PropertyValue\Criteria\AndCriteria;
Expand All @@ -30,6 +28,7 @@
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId;
use Neos\ContentRepository\Core\SharedModel\Node\PropertyName;
use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId;
use Neos\ContentRepository\Dbal\DbalSchemaFactory;

/**
* @internal Implementation detail of the DoctrineDbalAdapter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
use Neos\ContentRepository\Core\Feature\RootNodeCreation\Event\RootNodeAggregateWithNodeWasCreated;
use Neos\ContentRepository\Core\Feature\SubtreeTagging\Event\SubtreeWasTagged;
use Neos\ContentRepository\Core\Feature\SubtreeTagging\Event\SubtreeWasUntagged;
use Neos\ContentRepository\Core\Infrastructure\DbalSchemaDiff;
use Neos\ContentRepository\Core\Projection\ContentGraph\ContentGraphProjectionInterface;
use Neos\ContentRepository\Core\Projection\ContentGraph\ContentGraphReadModelInterface;
use Neos\ContentRepository\Core\Projection\ProjectionStatus;
use Neos\ContentRepository\Dbal\DbalSchemaDiff;
use Neos\EventStore\Model\EventEnvelope;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class ApiOrInternalAnnotationRule implements Rule
*/
private $namespacePrefixesWhichShouldBeEnforced = [
'Neos\ContentRepository\Core',
'Neos\ContentRepository\Dbal',
'Neos\ContentGraph',
];

Expand Down Expand Up @@ -60,11 +61,8 @@ public function processNode(Node $node, Scope $scope): array
return [];
}

private function nameIsWithinConfiguredNamespaces(?Node\Name $namespacedName): bool
private function nameIsWithinConfiguredNamespaces(Node\Name $namespacedName): bool
{
if (!$namespacedName) {
return false;
}
foreach ($this->namespacePrefixesWhichShouldBeEnforced as $namespacePrefix) {
if (str_starts_with($namespacedName->toString(), $namespacePrefix)) {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public function processNode(Node $node, Scope $scope): array
$scope->getNamespace()
&& (
str_starts_with($scope->getNamespace(), 'Neos\ContentRepository\Core')
|| str_starts_with($scope->getNamespace(), 'Neos\ContentRepository\Dbal')
|| str_starts_with($scope->getNamespace(), 'Neos\ContentGraph\DoctrineDbalAdapter')
|| str_starts_with($scope->getNamespace(), 'Neos\ContentRepository\BehavioralTests')
|| str_starts_with($scope->getNamespace(), 'Neos\ContentRepository\Export')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Types\Types;
use Neos\ContentRepository\Core\EventStore\EventInterface;
use Neos\ContentRepository\Core\Infrastructure\DbalSchemaDiff;
use Neos\ContentRepository\Core\Infrastructure\DbalSchemaFactory;
use Neos\ContentRepository\Core\Projection\ProjectionInterface;
use Neos\ContentRepository\Core\Projection\ProjectionStateInterface;
use Neos\ContentRepository\Core\Projection\ProjectionStatus;
use Neos\ContentRepository\Dbal\DbalSchemaDiff;
use Neos\ContentRepository\Dbal\DbalSchemaFactory;
use Neos\EventStore\Model\EventEnvelope;
use Neos\Flow\Annotations as Flow;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
use Neos\EventStore\Model\Event\StreamName;
use Neos\EventStore\Model\EventStream\EventStreamFilter;
use Neos\EventStore\Model\EventStream\VirtualStreamName;
use Doctrine\DBAL\Exception as DBALException;

/**
* Set up and manage a content repository
Expand Down Expand Up @@ -104,7 +103,8 @@ public function status(): ContentRepositoryStatus
try {
$lastEventEnvelope = current(iterator_to_array($this->eventStore->load(VirtualStreamName::all())->backwards()->limit(1))) ?: null;
$sequenceNumber = $lastEventEnvelope?->sequenceNumber ?? SequenceNumber::none();
} catch (DBALException) {
} catch (\Doctrine\DBAL\Exception) {
// todo do not depend on the dbal exception as this is totally implementation specific and the core has no dependency to dbal!
$sequenceNumber = null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Neos\ContentRepository\Core\Subscription\Engine;

use Doctrine\DBAL\Exception\TableNotFoundException;
use Neos\ContentRepository\Core\ContentRepository;
use Neos\ContentRepository\Core\EventStore\EventNormalizer;
use Neos\ContentRepository\Core\Service\ContentRepositoryMaintainer;
Expand Down Expand Up @@ -132,7 +131,8 @@ public function subscriptionStatus(SubscriptionEngineCriteria|null $criteria = n
$statuses = [];
try {
$subscriptions = $this->subscriptionStore->findByCriteriaForUpdate(SubscriptionCriteria::create(ids: $criteria?->ids));
} catch (TableNotFoundException) {
} catch (\Doctrine\DBAL\Exception\TableNotFoundException) {
// todo do not depend on the dbal exception as this is totally implementation specific and the core has no dependency to dbal!
// the schema is not setup - thus there are no subscribers
return SubscriptionStatusCollection::createEmpty();
}
Expand Down
2 changes: 0 additions & 2 deletions Neos.ContentRepository.Core/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@
],
"require": {
"neos/eventstore": "^1",
"neos/eventstore-doctrineadapter": "^1 || ^2",
"php": "^8.2",
"neos/error-messages": "*",
"neos/utility-objecthandling": "*",
"neos/utility-arrays": "*",
"doctrine/dbal": "^3.1.4",
"symfony/serializer": "^6.3",
"psr/clock": "^1",
"behat/transliterator": "~1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

declare(strict_types=1);

namespace Neos\ContentRepository\Core\Infrastructure;
namespace Neos\ContentRepository\Dbal;

use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\Schema\Comparator;
use Doctrine\DBAL\Schema\Schema;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Neos\ContentRepository\Core\Infrastructure;
namespace Neos\ContentRepository\Dbal;

use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Exception;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

declare(strict_types=1);

namespace Neos\ContentRepositoryRegistry\Factory\SubscriptionStore;
namespace Neos\ContentRepository\Dbal\SubscriptionStore;

use DateTimeImmutable;
use Doctrine\DBAL\ArrayParameterType;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Platforms\SqlitePlatform;
Expand All @@ -14,20 +13,19 @@
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Types\Types;
use Neos\ContentRepository\Core\Infrastructure\DbalSchemaDiff;
use Neos\ContentRepository\Core\Subscription\Store\SubscriptionCriteria;
use Neos\ContentRepository\Core\Subscription\Store\SubscriptionStoreInterface;
use Neos\ContentRepository\Core\Subscription\Subscription;
use Neos\ContentRepository\Core\Subscription\SubscriptionError;
use Neos\ContentRepository\Core\Subscription\SubscriptionId;
use Neos\ContentRepository\Core\Subscription\Subscriptions;
use Neos\ContentRepository\Core\Subscription\SubscriptionStatus;
use Neos\ContentRepository\Dbal\DbalSchemaDiff;
use Neos\EventStore\Model\Event\SequenceNumber;
use Psr\Clock\ClockInterface;
use Neos\Flow\Annotations as Flow;

/**
* @Flow\Proxy(false)
* @internal only API for custom content repository integrations
*/
final class DoctrineSubscriptionStore implements SubscriptionStoreInterface
{
Expand Down Expand Up @@ -156,7 +154,7 @@ private static function fromDatabase(array $row): Subscription
} else {
$subscriptionError = null;
}
$lastSavedAt = DateTimeImmutable::createFromFormat('Y-m-d H:i:s', $row['last_saved_at']);
$lastSavedAt = \DateTimeImmutable::createFromFormat('Y-m-d H:i:s', $row['last_saved_at']);
if ($lastSavedAt === false) {
throw new \RuntimeException(sprintf('last_saved_at %s is not a valid date', $row['last_saved_at']), 1733602968);
}
Expand Down
Loading