-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial commit (moved from the swoole bundle)
- Loading branch information
mfris
committed
Nov 8, 2019
0 parents
commit e757802
Showing
42 changed files
with
9,328 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Created by .ignore support plugin (hsz.mobi) | ||
vendor | ||
.php_cs.cache | ||
.phpunit.result.cache | ||
tests/Functional/app/data/* | ||
!tests/Functional/app/data/.gitkeep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
$config = PhpCsFixer\Config::create() | ||
->setRiskyAllowed(true) | ||
->setRules([ | ||
'array_syntax' => [ | ||
'syntax' => 'short', | ||
], | ||
'no_useless_else' => true, | ||
'no_useless_return' => true, | ||
'strict_comparison' => true, | ||
'strict_param' => true, | ||
'no_unused_imports' => true, | ||
]) | ||
->setFinder( | ||
PhpCsFixer\Finder::create() | ||
->exclude('vendor') | ||
->exclude('tests') | ||
->in(__DIR__) | ||
); | ||
|
||
return $config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 K911 | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Doctrine resettable entity manager bundle | ||
|
||
This bundle should be used with workloads where Symfony doesn't get initialized on each request, but stays in memory | ||
and the same instance handles multiple requests, one after another (e.g. when using | ||
[Swoole Bundle](https://github.com/pixelfederation/swoole-bundle)). | ||
Another use case would be message queue consuming (e.g. Symfony messenger), where it is needed | ||
to clear (and possibly reset) the entity manager after processing a message. | ||
|
||
The best feature of this bundle is, that it wraps all configured entity managers | ||
into a `ResettableEntityManager` instance, which | ||
is able to reset the entity manager when it gets stuck on an exception. | ||
After each request the entity manager gets cleared or reset, if an exception occurred during request handling. | ||
|
||
Also another feature is, that on each request start the entity manager connection gets pinged, so the connection | ||
won't get closed after some period of time. | ||
|
||
## Instalation | ||
|
||
`composer require pixelfederation/doctrine-resettable-em-bundle` | ||
|
||
## SETUP | ||
|
||
```php | ||
// config/bundles.php | ||
//... | ||
PixelFederation\CommandProcessingBundle\PixelFederationDoctrineResettableEmBundle::class => ['all' => true] | ||
//... | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
|
||
export PATH="/usr/local/bin:$PATH" | ||
|
||
# | ||
# Run the hook command. | ||
# Note: this will be replaced by the real command during copy. | ||
# | ||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
|
||
GIT_USER=$(git config user.name) | ||
GIT_EMAIL=$(git config user.email) | ||
COMMIT_MSG_FILE=$1 | ||
|
||
# Fetch the GIT diff and format it as command input: | ||
DIFF=$(git diff -r -p -m -M --full-index --staged | cat) | ||
|
||
# Run GrumPHP | ||
(cd "./" && printf "%s\n" "${DIFF}" | docker run -v `pwd`:/srv/www:delegated -u $(id -u):$(id -g) --rm -e GIT_USER="${GIT_USER}" -e GIT_EMAIL="${GIT_EMAIL}" -e COMMIT_MSG_FILE="${COMMIT_MSG_FILE}" doctrine-em-resetter-bundle bash -c "cd /srv/www && ./vendor/bin/grumphp git:commit-msg --ansi --git-user='${GIT_USER}' --git-email='${GIT_EMAIL}' '${COMMIT_MSG_FILE}'") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
export PATH="/usr/local/bin:$PATH" | ||
|
||
# | ||
# Run the hook command. | ||
# Note: this will be replaced by the real command during copy. | ||
# | ||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
|
||
docker build -t doctrine-em-resetter-bundle docker/php | ||
|
||
# Fetch the GIT diff and format it as command input: | ||
DIFF=$(git diff -r -p -m -M --full-index --staged | cat) | ||
|
||
# Run GrumPHP | ||
(cd "./" && printf "%s\n" "${DIFF}" | docker run -v `pwd`:/srv/www:delegated -u $(id -u):$(id -g) --rm doctrine-em-resetter-bundle bash -c "cd /srv/www && ./vendor/bin/grumphp git:pre-commit --ansi --skip-success-output") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{ | ||
"name": "pixelfederation/doctrine-resettable-em-bundle", | ||
"homepage": "https://github.com/pixelfederation/doctrine-resettable-em-bundle", | ||
"type": "symfony-bundle", | ||
"description": "Symfony bundle for decorating default entity managers using a resettable decorator.", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Martin Fris", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"php": ">=7.2 <7.4", | ||
"doctrine/orm": "^2.6", | ||
"sensio/framework-extra-bundle": "^5.2", | ||
"symfony/config": "^4.1", | ||
"symfony/dependency-injection": "^4.1", | ||
"symfony/orm-pack": "^1.0", | ||
"symfony/yaml": "^4.1" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"PixelFederation\\DoctrineResettableEmBundle\\": "src/" | ||
} | ||
}, | ||
"require-dev": { | ||
"friendsofphp/php-cs-fixer": "^2.15", | ||
"jakub-onderka/php-parallel-lint": "^1.0", | ||
"nikic/php-parser": "^4.2", | ||
"phpcompatibility/php-compatibility": "^9.1", | ||
"phpmd/phpmd": "^2.6", | ||
"phpro/grumphp": "^0.15", | ||
"phpstan/phpstan": "^0.11", | ||
"phpunit/phpunit": "^8.1", | ||
"roave/security-advisories": "dev-master", | ||
"squizlabs/php_codesniffer": "^3.4", | ||
"symfony/browser-kit": "^4.1", | ||
"symfony/framework-bundle": "^4.1", | ||
"symfony/http-kernel": "^4.1", | ||
"vimeo/psalm": "^3.2" | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"PixelFederation\\DoctrineResettableEmBundle\\Tests\\": "tests/" | ||
} | ||
}, | ||
"config": { | ||
"sort-packages": true | ||
} | ||
} |
Oops, something went wrong.