diff --git a/.github/workflows/docs-build-try.yml b/.github/workflows/docs-build-try.yml deleted file mode 100644 index bd943e1c..00000000 --- a/.github/workflows/docs-build-try.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Try build docs - -on: - pull_request: - push: - branches: - - "renovate/*" - -jobs: - build-try: - name: Deploy docs - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - - name: Set up Python - uses: actions/setup-python@v6 - with: - python-version: "3.x" - - - name: Install dependencies - run: pip install -r docs/requirements.txt - - - name: Build docs - working-directory: docs/ - run: | - mkdocs build --strict \ No newline at end of file diff --git a/.github/workflows/docs-build.yml b/.github/workflows/docs-build.yml deleted file mode 100644 index 13a58832..00000000 --- a/.github/workflows/docs-build.yml +++ /dev/null @@ -1,93 +0,0 @@ -name: Publish docs - -on: - push: - branches: - - "[0-9]+.[0-9]+.x" - release: - types: - - published - -jobs: - build: - name: Deploy docs - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - - name: Set up Python - uses: actions/setup-python@v6 - with: - python-version: "3.x" - - - name: Install dependencies - run: pip install -r docs/requirements.txt - - - name: Set up git author - uses: oleksiyrudenko/gha-git-credentials@v2 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Find latest release - id: latest_release - uses: pozetroninc/github-action-get-latest-release@v0.8.0 - with: - repository: ${{ github.repository }} - excludes: draft,prerelease - - - name: Normalize current versions - id: current - uses: actions/github-script@v8 - with: - script: return context.ref.match(/([0-9]+\.[0-9]+)\.(x|[0-9]+)/i)[1]; - result-encoding: string - - - name: Normalize latest versions - id: latest - uses: actions/github-script@v8 - with: - script: return "${{steps.latest_release.outputs.release}}".match(/([0-9]+\.[0-9]+)\.[0-9]+/i)[1]; - result-encoding: string - - - name: Setup deploy key - env: - DEPLOY_DOCS_KEY: ${{ secrets.DEPLOY_DOCS_KEY }} - run: | - # Setup SSH deploy key - mkdir -p ~/.ssh - echo "${DEPLOY_DOCS_KEY}" > ~/.ssh/id_rsa - chmod 600 ~/.ssh/id_rsa - ssh-keyscan -H github.com > ~/.ssh/known_hosts - - - run: git remote add doc git@github.com:patchlevel/event-sourcing-bundle-docs.git - - run: git fetch doc gh-pages --verbose - - - run: | - current_major=$(echo "${{ steps.current.outputs.result }}" | cut -d '.' -f 1) - current_minor=$(echo "${{ steps.current.outputs.result }}" | cut -d '.' -f 2) - - latest_major=$(echo "${{ steps.latest.outputs.result }}" | cut -d '.' -f 1) - latest_minor=$(echo "${{ steps.latest.outputs.result }}" | cut -d '.' -f 2) - - if [ "${{ steps.current.outputs.result }}" = "${{ steps.latest.outputs.result }}" ] - then - # Here we deploy a new latest version - mike deploy latest --config-file docs/mkdocs.yml --title="${{ steps.current.outputs.result }} (latest)" --push --remote doc - elif [ "$current_major" -lt "$latest_major" ] || \ - { [ "$current_major" -eq "$latest_major" ] && [ "$current_minor" -lt "$latest_minor" ]; } - then - # Here we deploy a version that's not the latest one and smaller as the latest version - mike deploy ${{ steps.current.outputs.result }} --config-file docs/mkdocs.yml --push --remote doc - fi - - run: | - # Check if the "latest" alias exists - HAS_LATEST=$(mike list --config-file docs/mkdocs.yml --rebase --remote doc | grep latest) || true - - # If so then it is set as the default version (to enable the index redirect) - if [ "${HAS_LATEST}" != "" ] - then - echo "Set latest as default" - mike set-default latest --config-file docs/mkdocs.yml --remote doc - fi \ No newline at end of file diff --git a/Makefile b/Makefile index fb55d2bf..6b8d3434 100644 --- a/Makefile +++ b/Makefile @@ -40,14 +40,6 @@ test: phpunit .PHONY: dev dev: static test ## run dev tools -.PHONY: docs -docs: mkdocs ## run mkdocs - cd docs && python3 -m mkdocs serve - -.PHONY: mkdocs -mkdocs: ## run mkdocs - cd docs && pip3 install -r requirements.txt - .PHONY: docs-extract-php docs-extract-php: bin/docs-extract-php-code diff --git a/bin/docs-extract-php-code b/bin/docs-extract-php-code index efcbf252..d50b642d 100755 --- a/bin/docs-extract-php-code +++ b/bin/docs-extract-php-code @@ -23,7 +23,7 @@ if (file_exists($targetDir)) { mkdir($targetDir); $finder = new Symfony\Component\Finder\Finder(); -$finder->files()->in(__DIR__ . '/../docs/pages')->name('*.md'); +$finder->files()->in(__DIR__ . '/../docs')->name('*.md'); foreach ($finder as $file) { $fileName = pathinfo($file->getBasename(), PATHINFO_FILENAME); diff --git a/bin/docs-inject-php-code b/bin/docs-inject-php-code index 8cd0e05f..e4e81ead 100755 --- a/bin/docs-inject-php-code +++ b/bin/docs-inject-php-code @@ -25,7 +25,7 @@ if (!file_exists($targetDir)) { } $finder = new Symfony\Component\Finder\Finder(); -$finder->files()->in(__DIR__ . '/../docs/pages')->name('*.md'); +$finder->files()->in(__DIR__ . '/../docs')->name('*.md'); foreach ($finder as $file) { $fileName = pathinfo($file->getBasename(), PATHINFO_FILENAME); diff --git a/docs/pages/configuration.md b/docs/configuration.md similarity index 72% rename from docs/pages/configuration.md rename to docs/configuration.md index 36305406..9a41b537 100644 --- a/docs/pages/configuration.md +++ b/docs/configuration.md @@ -1,15 +1,15 @@ # Configuration -!!! info +:::info +You can find out more about event sourcing in the library +[documentation](https://event-sourcing.patchlevel.io/latest/). +This documentation is limited to bundle integration and configuration. +::: - You can find out more about event sourcing in the library - [documentation](https://event-sourcing.patchlevel.io/latest/). - This documentation is limited to bundle integration and configuration. - -!!! tip +:::tip +We provide a [default configuration](./installation.md#configuration-file) that should work for most projects. +::: - We provide a [default configuration](./installation.md#configuration-file) that should work for most projects. - ## Aggregate A path must be specified for Event Sourcing to know where to look for your aggregates. @@ -27,14 +27,14 @@ patchlevel_event_sourcing: - '%kernel.project_dir%/src/Hotel/Domain' - '%kernel.project_dir%/src/Room/Domain' ``` -!!! note +:::note +The library will automatically register all classes marked with the `#[Aggregate]` attribute in the specified paths. +::: - The library will automatically register all classes marked with the `#[Aggregate]` attribute in the specified paths. - -!!! tip +:::tip +If you want to learn more about aggregates, read the [library documentation](https://event-sourcing.patchlevel.io/latest/aggregate/). +::: - If you want to learn more about aggregates, read the [library documentation](https://event-sourcing.patchlevel.io/latest/aggregate/). - ## Events A path must be specified for Event Sourcing to know where to look for your events. @@ -52,10 +52,10 @@ patchlevel_event_sourcing: - '%kernel.project_dir%/src/Hotel/Domain/Event' - '%kernel.project_dir%/src/Room/Domain/Event' ``` -!!! tip +:::tip +If you want to learn more about events, read the [library documentation](https://event-sourcing.patchlevel.io/latest/events/). +::: - If you want to learn more about events, read the [library documentation](https://event-sourcing.patchlevel.io/latest/events/). - ## Custom Headers If you want to implement custom headers for your application, you must specify the @@ -74,10 +74,10 @@ patchlevel_event_sourcing: - '%kernel.project_dir%/src/Hotel/Domain/Header' - '%kernel.project_dir%/src/Room/Domain/Header' ``` -!!! tip +:::tip +If you want to learn more about custom headers, read the [library documentation](https://event-sourcing.patchlevel.io/latest/message/#custom-headers). +::: - If you want to learn more about custom headers, read the [library documentation](https://event-sourcing.patchlevel.io/latest/message/#custom-headers). - ## Connection You have to specify the connection url to the event store. @@ -87,11 +87,11 @@ patchlevel_event_sourcing: connection: url: '%env(EVENTSTORE_URL)%' ``` -!!! note +:::note +You can find out more about how to create a connection +[here](https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html) +::: - You can find out more about how to create a connection - [here](https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html) - ### Connection for Projections Per default, our event sourcing connection is not available to use in your application. @@ -103,24 +103,27 @@ patchlevel_event_sourcing: url: '%env(EVENTSTORE_URL)%' provide_dedicated_connection: true ``` -!!! warning +:::warning +If you use doctrine migrations, you should exclude you projection tables from the schema generation. +The schema is managed by the subscription engine and should not be managed by doctrine. +::: - If you use doctrine migrations, you should exclude you projection tables from the schema generation. - The schema is managed by the subscription engine and should not be managed by doctrine. - -!!! tip +:::tip +You can autowire the connection in your services like this: - You can autowire the connection in your services like this: - - ```php - use Doctrine\DBAL\Connection; - +```php +use Doctrine\DBAL\Connection; + +class MyService +{ public function __construct( private readonly Connection $projectionConnection, ) { } - ``` - +} +``` +::: + ### Doctrine Bundle If you have installed the [doctrine bundle](https://github.com/doctrine/DoctrineBundle), @@ -137,21 +140,21 @@ patchlevel_event_sourcing: connection: service: doctrine.dbal.eventstore_connection ``` -!!! danger +:::danger +Do not use the same connection for event sourcing and your projections, +otherwise you may run into transaction problems. +::: - Do not use the same connection for event sourcing and your projections, - otherwise you may run into transaction problems. - -!!! warning +:::warning +If you want to use the same connection as doctrine orm, then you have to set the flag `merge_orm_schema`. +Otherwise you should avoid using the same connection as other tools. +::: - If you want to use the same connection as doctrine orm, then you have to set the flag `merge_orm_schema`. - Otherwise you should avoid using the same connection as other tools. - -!!! note +:::note +You can find out more about the dbal configuration +[here](https://symfony.com/bundles/DoctrineBundle/current/configuration.html). +::: - You can find out more about the dbal configuration - [here](https://symfony.com/bundles/DoctrineBundle/current/configuration.html). - If you are using Doctrine for your projections too, you need to create a dedicated connection for this. You can do this by defining a new connection named `projection` in the `doctrine.yaml` file and use the same connection url as for the event store. @@ -169,16 +172,16 @@ patchlevel_event_sourcing: connection: service: doctrine.dbal.eventstore_connection ``` -!!! warning +:::warning +You should exclude your projection tables from the schema generation. + +```yaml +doctrine: + dbal: + schema_filter: ~^(projection_)~ +``` +::: - You should exclude your projection tables from the schema generation. - - ```yaml - doctrine: - dbal: - schema_filter: ~^(projection_)~ - ``` - Then you can use this connection in your projections. If you are using autowiring you can inject the right connection `Connection $projectionConnection` parameter name. The prefix `projection` is used to identify the connection. @@ -218,10 +221,10 @@ Following store types are available: - `in_memory` - `custom` -!!! note +:::note +If you use `custom` store type, you need to set the service id under `patchlevel_event_sourcing.store.service`. +::: - If you use `custom` store type, you need to set the service id under `patchlevel_event_sourcing.store.service`. - ### Change table Name You can change the table name of the event store. @@ -242,10 +245,10 @@ patchlevel_event_sourcing: store: read_only: true ``` -!!! tip +:::tip +This is useful if you have maintenance work on the event store and you want to avoid side effects. +::: - This is useful if you have maintenance work on the event store and you want to avoid side effects. - ### Merge ORM Schema You can also merge the schema with doctrine orm. You have to set the following flag for this: @@ -255,19 +258,19 @@ patchlevel_event_sourcing: store: merge_orm_schema: true ``` -!!! warning +:::warning +If you want to merge the schema, then the same doctrine connection must be used as with the doctrine orm. +Otherwise errors may occur! +::: - If you want to merge the schema, then the same doctrine connection must be used as with the doctrine orm. - Otherwise errors may occur! - -!!! note +:::note +All schema relevant commands are removed if you activate this option. You should use the doctrine commands then. +::: - All schema relevant commands are removed if you activate this option. You should use the doctrine commands then. - -!!! tip +:::tip +If you want to learn more about store, read the [library documentation](https://event-sourcing.patchlevel.io/latest/store/). +::: - If you want to learn more about store, read the [library documentation](https://event-sourcing.patchlevel.io/latest/store/). - ### Kernel Reset Only available in `in_memory` store. If you want to reset the store after each kernel request, you can activate this option. @@ -295,16 +298,16 @@ patchlevel_event_sourcing: translators: - Patchlevel\EventSourcing\Message\Translator\AggregateToStreamHeaderTranslator ``` -!!! danger +:::danger +Make sure that you use different table names for the old and new store. +Otherwise your event store will be destroyed. +::: - Make sure that you use different table names for the old and new store. - Otherwise your event store will be destroyed. - -!!! tip +:::tip +Set the `read_only` flag to `true` for the old store to avoid side effects +and missing events during the migration. +::: - Set the `read_only` flag to `true` for the old store to avoid side effects - and missing events during the migration. - ## Migration You can use [doctrine migrations](https://www.doctrine-project.org/projects/migrations.html) to manage the schema. @@ -317,11 +320,11 @@ patchlevel_event_sourcing: ``` ## Subscription -!!! tip +:::tip +You can find out more about subscriptions in the library +[documentation](https://event-sourcing.patchlevel.io/latest/subscription/). +::: - You can find out more about subscriptions in the library - [documentation](https://event-sourcing.patchlevel.io/latest/subscription/). - ### Store You can change where the subscription engine stores its necessary information about the subscription. @@ -341,11 +344,11 @@ patchlevel_event_sourcing: type: 'custom' # default is 'dbal' service: 'my_subscription_store' ``` -!!! tip +:::tip +If you are using the [doctrine-test-bundle](https://github.com/dmaicher/doctrine-test-bundle), +you can use the `static_in_memory` store for testing. +::: - If you are using the [doctrine-test-bundle](https://github.com/dmaicher/doctrine-test-bundle), - you can use the `static_in_memory` store for testing. - ### Catch Up If aggregates are used in the processors and new events are generated there, @@ -369,10 +372,10 @@ patchlevel_event_sourcing: subscription: throw_on_error: true ``` -!!! warning +:::warning +This option should not be used in production. The normal behavior is to log the error and continue. +::: - This option should not be used in production. The normal behavior is to log the error and continue. - ### Run After Aggregate Save If you want to run the subscription engine after an aggregate is saved, you can activate this option. @@ -393,10 +396,10 @@ patchlevel_event_sourcing: subscription: auto_setup: true ``` -!!! note +:::note +This works only before each http requests and not if you use the console commands. +::: - This works only before each http requests and not if you use the console commands. - ### Rebuild After File Change If you want to rebuild the subscription engine after a file change, you can activate this option. @@ -407,14 +410,14 @@ patchlevel_event_sourcing: subscription: rebuild_after_file_change: true ``` -!!! note +:::note +This works only before each http requests and not if you use the console commands. +::: - This works only before each http requests and not if you use the console commands. - -!!! tip +:::tip +This is using the cache system to store the latest file change time. You can change the cache pool with the `cache_pool` option. +::: - This is using the cache system to store the latest file change time. You can change the cache pool with the `cache_pool` option. - ### Gap Detection Depending on the database you are using for the eventstore it may be happening that your subscriptions are skipping some @@ -429,14 +432,14 @@ patchlevel_event_sourcing: subscription: gap_detection: ~ ``` -!!! info +:::info +For more context you can read more about this in [this issue](https://github.com/patchlevel/event-sourcing/issues/727#issuecomment-2757297536). +::: - For more context you can read more about this in [this issue](https://github.com/patchlevel/event-sourcing/issues/727#issuecomment-2757297536). - -!!! tip +:::tip +You can use both techniques locking and gap detecion to mitigate gaps happening in the subscriptions. +::: - You can use both techniques locking and gap detecion to mitigate gaps happening in the subscriptions. - You can also define how often the gap detection should re-check the gap and how long it should wait, in this example we instantly retry the first time, then we wait 500ms and after that we check a last time after 1 second. @@ -477,10 +480,10 @@ patchlevel_event_sourcing: command_bus: service: command.bus ``` -!!! note +:::note +You can find out more about the command bus and the aggregate handlers [here](https://event-sourcing.patchlevel.io/latest/command_bus/). +::: - You can find out more about the command bus and the aggregate handlers [here](https://event-sourcing.patchlevel.io/latest/command_bus/). - ### Instant Retry You can define the default instant retry configuration for the command bus. @@ -494,10 +497,9 @@ patchlevel_event_sourcing: default_exceptions: - Patchlevel\EventSourcing\Repository\AggregateOutdated ``` - -!!! note - - You can find out more about instant retry [here](https://event-sourcing.patchlevel.io/latest/command_bus/#instant-retry). +:::note +You can find out more about instant retry [here](https://event-sourcing.patchlevel.io/latest/command_bus/#instant-retry). +::: ## Query Bus @@ -518,10 +520,10 @@ patchlevel_event_sourcing: query_bus: service: query.bus ``` -!!! note +:::note +You can find out more about the query bus [here](https://event-sourcing.patchlevel.io/latest/query_bus/). +::: - You can find out more about the query bus [here](https://event-sourcing.patchlevel.io/latest/query_bus/). - ## Event Bus You can enable the event bus to listen for events and messages synchronously. @@ -531,10 +533,10 @@ But you should consider using the subscription engine for this. patchlevel_event_sourcing: event_bus: ~ ``` -!!! note +:::note +Default is the patchlevel [event bus](https://event-sourcing.patchlevel.io/latest/event_bus/). +::: - Default is the patchlevel [event bus](https://event-sourcing.patchlevel.io/latest/event_bus/). - ### Patchlevel (Default) Event Bus First of all we have our own default event bus. @@ -545,10 +547,10 @@ patchlevel_event_sourcing: event_bus: type: default ``` -!!! note +:::note +You don't have to specify this as it is the default value. +::: - You don't have to specify this as it is the default value. - ### Symfony Event Bus But you can also use [Symfony Messenger](https://symfony.com/doc/current/messenger.html). @@ -600,11 +602,11 @@ patchlevel_event_sourcing: type: psr14 service: my.event.bus.service ``` -!!! note +:::note +Like the Symfony event bus, the event sourcing attributes no longer work here. +You have to use the system that comes with the respective psr14 implementation. +::: - Like the Symfony event bus, the event sourcing attributes no longer work here. - You have to use the system that comes with the respective psr14 implementation. - ### Custom Event Bus You can also use your own event bus that implements the `Patchlevel\EventSourcing\EventBus\EventBus` interface. @@ -615,11 +617,11 @@ patchlevel_event_sourcing: type: custom service: my.event.bus.service ``` -!!! note +:::note +Like the Symfony event bus, the event sourcing attributes no longer work here. +You have to use the system that comes with the respective custom implementation. +::: - Like the Symfony event bus, the event sourcing attributes no longer work here. - You have to use the system that comes with the respective custom implementation. - ## Snapshot You can use symfony cache to define the target of the snapshot store. @@ -658,10 +660,10 @@ final class Profile extends BasicAggregateRoot // ... } ``` -!!! note +:::note +You can find out more about snapshots [here](https://event-sourcing.patchlevel.io/latest/snapshots/). +::: - You can find out more about snapshots [here](https://event-sourcing.patchlevel.io/latest/snapshots/). - ## Cryptography You can use the library to encrypt and decrypt personal data. @@ -672,12 +674,11 @@ patchlevel_event_sourcing: cryptography: use_encrypted_field_name: true, ``` - -!!! tip - - You should activate `use_encrypted_field_name` to mark the fields that are encrypted. - That allows you later to migrate not encrypted fields to encrypted fields. - If you have already encrypted fields, you can activate `fallback_to_field_name` to use the old field name as fallback. +:::tip +You should activate `use_encrypted_field_name` to mark the fields that are encrypted. +That allows you later to migrate not encrypted fields to encrypted fields. +If you have already encrypted fields, you can activate `fallback_to_field_name` to use the old field name as fallback. +::: If you want to use another algorithm, you can specify this here: @@ -686,10 +687,10 @@ patchlevel_event_sourcing: cryptography: algorithm: 'aes-256-gcm' ``` -!!! note +:::note +You can find out more about personal data [here](https://event-sourcing.patchlevel.io/latest/personal_data/). +::: - You can find out more about personal data [here](https://event-sourcing.patchlevel.io/latest/personal_data/). - ## Clock The clock is used to return the current time as DateTimeImmutable. @@ -704,10 +705,10 @@ when@test: clock: freeze: '2020-01-01 22:00:00' ``` -!!! note +:::note +If freeze is not set, then the system clock is used. +::: - If freeze is not set, then the system clock is used. - ### Symfony Clock Since symfony 6.2 there is a [clock](https://symfony.com/doc/current/components/clock.html) implementation diff --git a/docs/pages/getting_started.md b/docs/getting-started.md similarity index 87% rename from docs/pages/getting_started.md rename to docs/getting-started.md index 43c33b95..5f7b72ff 100644 --- a/docs/pages/getting_started.md +++ b/docs/getting-started.md @@ -5,11 +5,11 @@ We keep the example small, so we can only create hotels and let guests check in For this example we use [symfony/mailer](https://symfony.com/doc/current/mailer.html). -!!! info +:::info +First of all, the bundle has to be installed and configured. +If you haven't already done so, see the [installation introduction](installation.md). +::: - First of all, the bundle has to be installed and configured. - If you haven't already done so, see the [installation introduction](installation.md). - ## Define some events First we define the events that happen in our system. @@ -68,10 +68,10 @@ final class GuestIsCheckedOut } } ``` -!!! note +:::note +You can find out more about events in the [library](https://event-sourcing.patchlevel.io/latest/events/). +::: - You can find out more about events in the [library](https://event-sourcing.patchlevel.io/latest/events/). - ## Define aggregates Next we need to define the hotel aggregate. @@ -168,10 +168,10 @@ final class Hotel extends BasicAggregateRoot } } ``` -!!! note +:::note +You can find out more about aggregates in the [library](https://event-sourcing.patchlevel.io/latest/aggregate/). +::: - You can find out more about aggregates in the [library](https://event-sourcing.patchlevel.io/latest/aggregate/). - ## Define projections Now we want to see which guests are currently checked in at a hotel or when a guest checked in and out. @@ -279,14 +279,14 @@ final class GuestProjection } } ``` -!!! warning +:::warning +autoconfigure need to be enabled, otherwise you need add the `event_sourcing.subscriber` tag. +::: - autoconfigure need to be enabled, otherwise you need add the `event_sourcing.subscriber` tag. - -!!! note +:::note +You can find out more about projections in the [library](https://event-sourcing.patchlevel.io/latest/subscription/). +::: - You can find out more about projections in the [library](https://event-sourcing.patchlevel.io/latest/subscription/). - ## Processor In our example we also want to send an email to the head office as soon as a guest is checked in. @@ -323,14 +323,14 @@ final class SendCheckInEmailProcessor } } ``` -!!! warning +:::warning +autoconfigure need to be enabled, otherwise you need add the `event_sourcing.subscriber` tag. +::: - autoconfigure need to be enabled, otherwise you need add the `event_sourcing.subscriber` tag. - -!!! note +:::note +You can find out more about processor in the [library](https://event-sourcing.patchlevel.io/latest/subscription/) +::: - You can find out more about processor in the [library](https://event-sourcing.patchlevel.io/latest/subscription/) - ## Database setup So that we can actually write the data to a database, we need the associated schema and databases. @@ -345,10 +345,10 @@ or you can use doctrine migrations: bin/console event-sourcing:migrations:diff bin/console event-sourcing:migrations:migrate ``` -!!! note +:::note +You can find out more about the cli in the [library](https://event-sourcing.patchlevel.io/latest/cli/). +::: - You can find out more about the cli in the [library](https://event-sourcing.patchlevel.io/latest/cli/). - ## Usage We are now ready to use the Event Sourcing System. We can load, change and save aggregates. @@ -422,15 +422,14 @@ final class HotelController ``` ## Result -!!! success +:::success +We have successfully implemented and used event sourcing. - We have successfully implemented and used event sourcing. - - Feel free to browse further in the documentation for more detailed information. - If there are still open questions, create a ticket on Github and we will try to help you. - -!!! note +Feel free to browse further in the documentation for more detailed information. +If there are still open questions, create a ticket on Github and we will try to help you. +::: - This documentation is limited to the bundle integration. - You should also read the [library documentation](https://event-sourcing.patchlevel.io/latest/). - \ No newline at end of file +:::note +This documentation is limited to the bundle integration. +You should also read the [library documentation](https://event-sourcing.patchlevel.io/latest/). +::: diff --git a/docs/pages/index.md b/docs/index.md similarity index 86% rename from docs/pages/index.md rename to docs/index.md index 04cd6ab3..2a56f889 100644 --- a/docs/pages/index.md +++ b/docs/index.md @@ -24,15 +24,15 @@ for [event-sourcing](https://github.com/patchlevel/event-sourcing) library. ```bash composer require patchlevel/event-sourcing-bundle ``` -!!! info +:::info +If you don't use the symfony flex recipe for this bundle, you need to follow +this [installation documentation](installation.md). +::: - If you don't use the symfony flex recipe for this bundle, you need to follow - this [installation documentation](installation.md). - -!!! tip +:::tip +Start with the [quickstart](./getting_started.md) to get a feeling for the bundle. +::: - Start with the [quickstart](./getting_started.md) to get a feeling for the bundle. - ## Integration * [Psalm](https://github.com/patchlevel/event-sourcing-psalm-plugin) diff --git a/docs/pages/installation.md b/docs/installation.md similarity index 85% rename from docs/pages/installation.md rename to docs/installation.md index cc0ce51a..c05eda54 100644 --- a/docs/pages/installation.md +++ b/docs/installation.md @@ -11,10 +11,10 @@ The first thing to do is to install packet if it has not already been done. ```bash composer require patchlevel/event-sourcing-bundle ``` -!!! note +:::note +how to install [composer](https://getcomposer.org/doc/00-intro.md) +::: - how to install [composer](https://getcomposer.org/doc/00-intro.md) - ## Enable bundle Then we have to activate the bundle in the `config/bundles.php`: @@ -61,10 +61,10 @@ Finally, we have to fill the ENV variable with a connection url. ```dotenv EVENTSTORE_URL="pdo-pgsql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=16&charset=utf8" ``` -!!! note +:::note +You can find out more about what a connection url looks like [here](https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url). +::: - You can find out more about what a connection url looks like [here](https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url). - ## Database with Docker If you are using docker, you can use the following `compose.yaml` file to start a postgres database. @@ -104,7 +104,6 @@ For this you have to add the following configuration to the `.symfony.local.yaml workers: docker_compose: ~ ``` -!!! success - - You have successfully installed the bundle. Now you can start with the [quickstart](./getting_started.md) to get a feeling for the bundle. - \ No newline at end of file +:::success +You have successfully installed the bundle. Now you can start with the [quickstart](./getting_started.md) to get a feeling for the bundle. +::: diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml deleted file mode 100644 index f8343080..00000000 --- a/docs/mkdocs.yml +++ /dev/null @@ -1,102 +0,0 @@ -# yaml-language-server: $schema=https://squidfunk.github.io/mkdocs-material/schema.json - -site_name: Event Sourcing Symfony Bundle -site_description: A lightweight but also all-inclusive event sourcing bundle with a focus on developer experience and based on doctrine dbal. -site_author: patchlevel -site_url: https://event-sourcing-bundle.patchlevel.io/ -repo_url: https://github.com/patchlevel/event-sourcing-bundle -repo_name: patchlevel/event-sourcing-bundle -edit_uri: edit/2.0.x/docs/pages/ -docs_dir: pages - -extra: - meta: - title: Event Sourcing Symfony Bundle - description: An event sourcing bundle, complete with all the essential features, powered by the reliable Doctrine ecosystem and focused on developer experience. - image: img/patchlevel-banner.png - social: - - icon: fontawesome/brands/github - link: https://github.com/patchlevel - - icon: fontawesome/solid/globe - link: https://patchlevel.de - - icon: fontawesome/brands/twitter - link: https://twitter.com/patchlevelhq - version: - provider: mike - analytics: - provider: custom - -extra_css: - - stylesheets/extra.css - -theme: - name: material - custom_dir: overrides - logo: assets/logo.png - favicon: assets/favicon.png - features: - - navigation.sections - - navigation.top - - navigation.indexes - - navigation.footer - - content.code.annotate - - content.code.copy - palette: - - media: "(prefers-color-scheme: light)" - scheme: default - primary: black - accent: blue - toggle: - icon: material/brightness-7 - name: Switch to dark mode - - media: "(prefers-color-scheme: dark)" - scheme: slate - primary: black - accent: blue - toggle: - icon: material/brightness-4 - name: Switch to light mode - -plugins: - - search: - - mike: - canonical_version: latest - -markdown_extensions: - - meta - - pymdownx.highlight: - anchor_linenums: true - extend_pygments_lang: - - name: php - lang: php - options: - startinline: true - - pymdownx.inlinehilite - - pymdownx.snippets: - auto_append: - - docs/includes/links.md - - admonition - - pymdownx.emoji: - emoji_index: !!python/name:materialx.emoji.twemoji - emoji_generator: !!python/name:materialx.emoji.to_svg - - def_list - - pymdownx.tasklist: - custom_checkbox: true - - pymdownx.superfences: - custom_fences: - - name: mermaid - class: mermaid - format: !!python/name:pymdownx.superfences.fence_code_format - -nav: - - Introduction: index.md - - Installation: installation.md - - Getting Started: getting_started.md - - Configuration: configuration.md - - Usage: usage.md - - Links: - - Blog: https://patchlevel.de/blog - - Library Documentation: https://event-sourcing.patchlevel.io/latest/ - - Admin Bundle: https://github.com/patchlevel/event-sourcing-admin-bundle - - Psalm Plugin: https://github.com/patchlevel/event-sourcing-psalm-plugin - - Hydrator: https://github.com/patchlevel/hydrator diff --git a/docs/overrides/assets/favicon.png b/docs/overrides/assets/favicon.png deleted file mode 100644 index 86e8fb7b..00000000 Binary files a/docs/overrides/assets/favicon.png and /dev/null differ diff --git a/docs/overrides/assets/logo.png b/docs/overrides/assets/logo.png deleted file mode 100644 index be170fed..00000000 Binary files a/docs/overrides/assets/logo.png and /dev/null differ diff --git a/docs/overrides/main.html b/docs/overrides/main.html deleted file mode 100644 index 9cfcb55a..00000000 --- a/docs/overrides/main.html +++ /dev/null @@ -1,18 +0,0 @@ -{% extends "base.html" %} - -{% block extrahead %} - - - - - - - -{% endblock %} - -{% block outdated %} -You're not viewing the latest version. - - Click here to go to latest. - -{% endblock %} \ No newline at end of file diff --git a/docs/overrides/partials/integrations/analytics/custom.html b/docs/overrides/partials/integrations/analytics/custom.html deleted file mode 100644 index af4cc148..00000000 --- a/docs/overrides/partials/integrations/analytics/custom.html +++ /dev/null @@ -1,13 +0,0 @@ - \ No newline at end of file diff --git a/docs/pages/stylesheets/extra.css b/docs/pages/stylesheets/extra.css deleted file mode 100644 index 26494c71..00000000 --- a/docs/pages/stylesheets/extra.css +++ /dev/null @@ -1,43 +0,0 @@ -:root > * { - --md-code-hl-number-color: #6897BB; - --md-code-hl-special-color: #C7CDD7; - --md-code-hl-function-color: #FFC66D; - --md-code-hl-constant-color: #9876AA; - --md-code-hl-keyword-color: #CC7832; - --md-code-hl-string-color: #6A8759; - --md-code-hl-name-color: red; - --md-code-hl-operator-color: #C7CDD7; - --md-code-hl-punctuation-color: #C7CDD7; - --md-code-hl-comment-color: #629755; - --md-code-hl-generic-color: red; - --md-code-hl-variable-color: #9876AA; - - --md-code-fg-color: #C7CDD7; - --md-code-bg-color: rgb(39, 42, 53); - --md-code-hl-color: red; -} - -p { - margin-block-start: 2em; - margin-block-end: 2em; -} - -.md-typeset code { - padding: .2em .4em; - font-size: .9em; - line-height: 1.8; - border-radius: .2rem; -} - -[data-md-color-scheme=default] .md-typeset code:not(pre code) { - background-color: #f5f5f5; - color: #36464e; -} - -.admonition-title { - margin-bottom: -1em !important; -} - -.md-nav__link--active { - font-weight: bold; -} \ No newline at end of file diff --git a/docs/project.json b/docs/project.json new file mode 100644 index 00000000..cfdca365 --- /dev/null +++ b/docs/project.json @@ -0,0 +1,24 @@ +{ + "navigation": [ + { + "title": "Introduction", + "file": "index.md" + }, + { + "title": "Installation", + "file": "installation.md" + }, + { + "title": "Getting Started", + "file": "getting-started.md" + }, + { + "title": "Configuration", + "file": "configuration.md" + }, + { + "title": "Usage", + "file": "usage.md" + } + ] +} diff --git a/docs/requirements.txt b/docs/requirements.txt deleted file mode 100644 index 83a01a64..00000000 --- a/docs/requirements.txt +++ /dev/null @@ -1,11 +0,0 @@ -mkdocs==1.6.1 -mike==2.1.3 -markdown==3.10 -mkdocs-material==9.7.0 - -# Markdown extensions -Pygments==2.19.2 -pymdown-extensions==10.18 - -# MkDocs plugins -mkdocs-material-extensions==1.3.1 \ No newline at end of file diff --git a/docs/pages/usage.md b/docs/usage.md similarity index 89% rename from docs/pages/usage.md rename to docs/usage.md index d2e3ee1f..78d7d217 100644 --- a/docs/pages/usage.md +++ b/docs/usage.md @@ -3,12 +3,12 @@ Here you will find some examples of how to use the bundle. But we provide only examples for specific symfo -!!! info +:::info +You can find out more about event sourcing in the library +[documentation](https://event-sourcing.patchlevel.io/latest/). +This documentation is limited to bundle integration and configuration. +::: - You can find out more about event sourcing in the library - [documentation](https://event-sourcing.patchlevel.io/latest/). - This documentation is limited to bundle integration and configuration. - ## Repository You can access the specific repositories using the `RepositoryManager::get`. Or inject directly the right repository via @@ -140,19 +140,19 @@ services: - name: event_sourcing.listener priority: 16 ``` -!!! warning +:::warning +You have to deactivate the `autoconfigure` for this service, +otherwise the service will be added twice. +::: - You have to deactivate the `autoconfigure` for this service, - otherwise the service will be added twice. - ## Normalizer This bundle adds more Symfony specific normalizers in addition to the existing built-in normalizers. -!!! note +:::note +You can find the other build-in normalizers [here](https://event-sourcing.patchlevel.io/latest/normalizer/#built-in-normalizer) +::: - You can find the other build-in normalizers [here](https://event-sourcing.patchlevel.io/latest/normalizer/#built-in-normalizer) - ### Uuid With the `Uuid` Normalizer, as the name suggests, you can convert Symfony Uuid objects to a string and back again. @@ -167,14 +167,14 @@ final class DTO public Uuid $id; } ``` -!!! warning +:::warning +The symfony uuid don't implement the `AggregateId` interface, so it can be used as aggregate id. +::: - The symfony uuid don't implement the `AggregateId` interface, so it can be used as aggregate id. - -!!! tip +:::tip +Use the `Uuid` implementation and `IdNormalizer` from the library to use it as an aggregate id. +::: - Use the `Uuid` implementation and `IdNormalizer` from the library to use it as an aggregate id. - ## Upcasting ```php