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 / 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 / ObjectSelect.php
Last active December 27, 2023 19:32
DoctrineModule\Form\ObjectSelect fix to define custom value property
<?php
namespace Application\Form\Element;
use Application\Form\Element\ObjectSelect\Proxy;
use DoctrineModule\Form\Element\ObjectSelect as DoctrineObjectSelect;
/**
* Class ObjectSelect
*
* Extends doctrines ObjectSelect to provide own Proxy implementation
@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 / MongoConnection.php
Last active May 9, 2022 14:55
prooph MongoEventStore v7
<?php
declare(strict_types = 1);
namespace Acme\Infrastructure\MongoDb;
use MongoDB\Client;
use MongoDB\Collection;
class MongoConnection
@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 / CargoRouteListner.php
Last active April 30, 2020 11:11
getprooph.org sample snippet
<?php
declare(strict_types=1);
class CargoRouteListener extends ProcessManager
{
function listenOn(DestiniationWasChanged $event)
{
$rerouteCargo = RerouteCargo::to(
$event->newDestination(),
$event->cargoId()
{
"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 / 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)
}
}