Skip to content

Instantly share code, notes, and snippets.

@Mattin
Mattin / ProjectionCommand.php
Created Jun 7, 2021
Prooph Projection with GapDetection
View ProjectionCommand.php
<?php
declare(strict_types=1);
/**
* TRIFFT BACKEND
* @copyright Copyright (c) 2019 TRIFFT ME s.r.o. (https://www.trifft.me)
* @author Matus Nickel <matus@trifft.me>
*/
@Ocramius
Ocramius / Day.php
Created Apr 3, 2020
Example abstraction that only allows a resolution of "day" for time inside a specific business domain
View Day.php
<?php
declare(strict_types=1);
namespace Core\Domain\Time;
use DateTimeImmutable;
use DateTimeZone;
use Generator;
use Iterator;
@adelineu
adelineu / to_json_object.php
Created Apr 15, 2019
Convert a PHP array to a mysql JSON_OBJECT
View to_json_object.php
<?php
function to_JSON_OBJECT($a)
{
$json = json_encode($a, JSON_PRETTY_PRINT);
// split into lines
$lines = explode("\n", $json);
foreach ($lines as $key => $line) {
// remove space
View README.md

Issue

Projectors fail with contraint errors when rebuilding read models.

Setup description

Implementations of Prooph\EventStore\Projection\AbstractReadModel are used to build read-models. We are using Doctrine Entities for these models. ReadModelProjector::OPTION_PERSIST_BLOCK_SIZE is set to 1000 The persist method of Prooph\EventStore\Projection\AbstractReadModel has been adapted to wrap the stack of changes inside a transaction. (see ReadModelTrait.php)

View CombinedReadModel.php
<?php
declare(strict_types=1);
namespace Funct\Ion\Microsite\Base\ReadModel\MicrositeCollections;
use Prooph\EventStore\Projection\AbstractReadModel;
use RuntimeException;
final class CombinedReadModel extends AbstractReadModel
View BigIdSingelStreamStrategy.php
<?php
final class BigIdSingleStreamStrategy implements PersistenceStrategy, HasQueryHint
{
/**
* @param string $tableName
* @return string[]
*/
public function createSchema(string $tableName): array
{
@kai101
kai101 / wkhtmltopdf.md
Last active Apr 11, 2021
How to Install Wkhtmltopdf 12.4 with patched Qt?
View wkhtmltopdf.md

How to Install Wkhtmltopdf 12.4 with patched Qt?

For earlier version whos suffering from versionlock syndrome. Please follow the instructions to rollback to older SSL interface. Do not alarm by the fallback ssl interface, they received security patches for vulnerability discovered.

Current version of apt-get wkhtmltopdf does not come with Qt patch. There are some issue going with both Qt patched and non-patched. Most common use case is compatible with the patched Qt.

View ddl_prooph.sql
# Event Stream
CREATE TABLE `event_streams` (
`no` BIGINT(20) NOT NULL AUTO_INCREMENT,
`real_stream_name` VARCHAR(150) NOT NULL,
`stream_name` CHAR(41) NOT NULL,
`metadata` TEXT NOT NULL,
`category` VARCHAR(150),
CHECK (`metadata` IS NOT NULL OR JSON_VALID(`metadata`)),
PRIMARY KEY (`no`),
UNIQUE KEY `ix_rsn` (`real_stream_name`),
@codeliner
codeliner / MongoConnection.php
Last active Apr 6, 2017
prooph MongoEventStore v7
View MongoConnection.php
<?php
declare(strict_types = 1);
namespace Acme\Infrastructure\MongoDb;
use MongoDB\Client;
use MongoDB\Collection;
class MongoConnection
@chalasr
chalasr / splat_operator.php
Last active Apr 11, 2016
function with dynamic number of type-hinted arguments using the splat operator PHP 5.6
View splat_operator.php
<?php
function splat(array ...$args) {
foreach ($args as $arg) {
print_r($arg);
}
}
splat(['firstArray'], ['secondArray']);
// Output: Array( [0] => firstArray ) Array( [0] => secondArray )