Skip to content

Instantly share code, notes, and snippets.

View codeliner's full-sized avatar
🌐
OSS Contributor

Alexander Miertsch codeliner

🌐
OSS Contributor
View GitHub Profile
@codeliner
codeliner / DDD_avoid_large_cluster_example.php
Created July 7, 2015 19:07
This example illustrates modelling small aggregates instead of a large cluster: See discussion: https://groups.google.com/forum/#!topic/dddinphp/WBKuPAT0OS8
<?php
/*
* This example illustrates modelling the following use cases:
*
* - A user can write and publish an article, with the title, description.etc.
* - X users can then respond to said article by posting comments,
* - and responding to one another.
* - it is very common for an Article to be 'locked' when it becomes older.
*
* Note: The example is an incomplete draft.
@codeliner
codeliner / DoctrineSharedConnectionAdapter.php
Last active February 14, 2016 17:22
An example of a decorated Prooph\EventStore\Adapter\DoctrineEventStoreAdapter that uses a shared database connection between write and read model. This can be useful if you want to avoid eventual consistency issues (only possible if same database is used for write/read).
<?php
namespace App\Infrastructure\EventStore;
use DateTimeInterface;
use Iterator;
use Prooph\EventStore\Adapter\Adapter;
use Prooph\EventStore\Adapter\Doctrine\DoctrineEventStoreAdapter;
use Prooph\EventStore\Exception\StreamNotFoundException;
use Prooph\EventStore\Stream\Stream;
@codeliner
codeliner / Message.php
Last active December 10, 2016 19:34
Single prooph message class
<?php
declare(strict_types = 1);
namespace Acme\Model;
use Prooph\Common\Messaging\DomainMessage;
use Prooph\Common\Messaging\Message as ProophMessage;
class Message extends DomainMessage
{
@codeliner
codeliner / bc_interaction_sample.php
Created April 15, 2014 13:06
Sample to show interaction between two bounded contexts
<?php
/**
* This file is an example gist to show the interaction between an ArticleContext and a LikeContext
*
* @example:
*
* We have to bounded contexts: ArticleContext and LikeContext and show the simplified process of following use case:
*
* In order to create a valid article Like, I should validate the article ID given to the LikeContext.
*
@codeliner
codeliner / OrgaState.php
Last active September 6, 2017 06:20
Workshop material
<?php
declare(strict_types=1);
namespace App\Model\Organization;
final class OrgaState
{
public $orgaId;
public $orgaName;
@codeliner
codeliner / ExcludeBlacklistedFiles.php
Last active November 3, 2017 01:10
proophessor-do message flow analyzed with prooph/message-flow-analyzer
<?php
declare(strict_types=1);
namespace Prooph\ProophessorDo\Infrastructure\ProophAnalyzer;
use Prooph\MessageFlowAnalyzer\Filter\FileInfoFilter;
final class ExcludeBlacklistedFiles implements FileInfoFilter
{
@codeliner
codeliner / ReactTest.tsx
Created August 9, 2017 06:35
React TS app to reproduce TS inspection errors in PhpStorm
import React from 'react'
interface ReactTestProps {foo: string, bar: string}
class ReactTest extends React.Component<ReactTestProps, {}> {
constructor(props: ReactTestProps) {
super(props)
}
}
{
"variables": [],
"info": {
"name": "EventMachine Example",
"_postman_id": "89698ba0-98f0-cc94-2f71-9f19c183e3f3",
"description": "",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
},
"item": [
{
@codeliner
codeliner / Event-Sourced-Saga.xml
Created August 1, 2018 18:25
ES-Emergency-Call-Issue-6 - draw.io diagram
<mxfile userAgent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/67.0.3396.99 Chrome/67.0.3396.99 Safari/537.36" version="9.0.1" editor="www.draw.io" type="device"><diagram id="bcd6b23c-19de-0d42-889d-0b111b864ca3" name="Page-1">7Vxbc6O4Ev41rpp5iIubMX7MZXzOqdqdk9qkancfZZBt1QBihZzE59efFhJXYYc4GDO7TiYDtIQk1N2fWt0NE/s+evsXQ8n2VxrgcGIZwdvEfphYlulYLhwEZS8pc9OThA0jgapUEp7I/7AiGoq6IwFOaxU5pSEnSZ3o0zjGPq/REGP0tV5tTcN6rwnaYI3w5KNQp/5OAr6VVM+al/R/Y7LZ5j2b7kKWrJD/Y8PoLlb9TSx7nf3I4gjlbakHTbcooK8Vkv1tYt8zSrk8i97ucSjmNp82ed/yQGkxboZj3uUGS97wgsIdzkfshnDrXZqgGM434vw3/NcOp/wR7SPRrqqxYnn5bRhSH3FC41QvvKdRhGA+VAGMpdq0mga+z6ceZiQRpzHlcLh73RKOnxLkC9orSBvQtjwK4coU3RTz/d8dD0mMFT3ljP7A9zSkLGvWdn0Pr9ZFSc5VGyhrEoaVmgHC3toXdBpzJZqmpa4r9ew78Qt0FJJNDDQf5gaz4pleMOP47SBfzILboEWYRpizPVRRN3gzeYfSH9NV8vJaSqOZK8u2Kom5YCGlAZui6VIK4EQJQrtQ2JpQKM4f5fPtZsPwBgHXtKKhmBy4K3fmdmEyaKTlX5rJ9sybXpLPzvt81nmpsAAHetG3l1Z0GIz788XKMLpxH7sX5747My7I+1kL8DfYhOPgVqyl4rlDlKbErzNGY8D9QvxqDLA+MNEwd2z/BxCN/OJPcQFqApdvhP+h+hbnZY