Skip to content

Commit 5f776a3

Browse files
committed
Init
0 parents  commit 5f776a3

File tree

11 files changed

+260
-0
lines changed

11 files changed

+260
-0
lines changed

.gitattributes

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.editorconfig export-ignore
2+
.gitattributes export-ignore
3+
.gitignore export-ignore
4+
/.php_cs export-ignore
5+
/.styleci.yml export-ignore
6+
/.scrutinizer.yml export-ignore
7+
/.travis.yml export-ignore
8+
/tests/ export-ignore

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/vendor/
2+
/composer.lock
3+
/php_cs.cache

.php_cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()
4+
->in(__DIR__.'/src')
5+
->in(__DIR__.'/tests')
6+
;
7+
8+
return PhpCsFixer\Config::create()
9+
->setRules([
10+
'@Symfony' => true,
11+
'array_syntax' => ['syntax' => 'short'],
12+
])
13+
->setFinder($finder)
14+
;

.scrutinizer.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
filter:
2+
excluded_paths: [vendor/*, tests/*]
3+
checks:
4+
php:
5+
code_rating: true
6+
duplication: true
7+
tools:
8+
external_code_coverage:
9+
timeout: 1800 # Timeout in seconds.

.travis.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
language: php
2+
sudo: false
3+
cache:
4+
directories:
5+
- $HOME/.composer/cache/files
6+
- $HOME/symfony-bridge/.phpunit
7+
8+
env:
9+
global:
10+
- PHPUNIT_FLAGS="-v"
11+
- SYMFONY_PHPUNIT_DIR="$HOME/symfony-bridge/.phpunit"
12+
13+
matrix:
14+
fast_finish: true
15+
include:
16+
# Minimum supported dependencies with the latest and oldest PHP version
17+
- php: 7.2
18+
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="max[self]=0"
19+
- php: 7.3
20+
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="max[self]=0"
21+
22+
# Test the latest stable release
23+
- php: 7.2
24+
- php: 7.3
25+
env: COVERAGE=true PHPUNIT_FLAGS="-v --coverage-text --coverage-clover=coverage.xml"
26+
27+
# Force some major versions of Symfony
28+
- php: 7.2
29+
env: SYMFONY_VERSION="3.*"
30+
- php: 7.2
31+
env: SYMFONY_VERSION="4.*"
32+
33+
# Latest commit to master
34+
- php: 7.3
35+
env: STABILITY="dev"
36+
37+
allow_failures:
38+
# Dev-master is allowed to fail.
39+
- env: STABILITY="dev"
40+
41+
before_install:
42+
- if [[ $COVERAGE != true ]]; then phpenv config-rm xdebug.ini || true; fi
43+
- if ! [ -z "$STABILITY" ]; then composer config minimum-stability ${STABILITY}; fi;
44+
- composer require --no-update symfony/flex ${DEPENDENCIES}
45+
- if ! [ -z "$SYMFONY_VERSION" ]; then composer config extra.symfony.require "${SYMFONY_VERSION}"; fi;
46+
47+
48+
install:
49+
- composer update ${COMPOSER_FLAGS} --prefer-dist --no-interaction
50+
- ./vendor/bin/simple-phpunit install
51+
52+
script:
53+
- composer validate --strict --no-check-lock
54+
- ./vendor/bin/simple-phpunit $PHPUNIT_FLAGS
55+
56+
after_success:
57+
- if [[ $COVERAGE = true ]]; then wget https://scrutinizer-ci.com/ocular.phar; fi
58+
- if [[ $COVERAGE = true ]]; then php ocular.phar code-coverage:upload --format=php-clover coverage.xml; fi

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2019 Happyr
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Readme.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Symfony validator for Entity Exist
2+
3+
[![Latest Version](https://img.shields.io/github/release/happyr/entity-exists-validation-constraint.svg?style=flat-square)](https://github.com/happyr/entity-exists-validation-constraint/releases)
4+
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
5+
[![Build Status](https://img.shields.io/travis/happyr/entity-exists-validation-constraint.svg?style=flat-square)](https://travis-ci.org/happyr/entity-exists-validation-constraint)
6+
[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/happyr/entity-exists-validation-constraint.svg?style=flat-square)](https://scrutinizer-ci.com/g/happyr/entity-exists-validation-constraint)
7+
[![Quality Score](https://img.shields.io/scrutinizer/g/happyr/entity-exists-validation-constraint.svg?style=flat-square)](https://scrutinizer-ci.com/g/happyr/entity-exists-validation-constraint)
8+
[![Total Downloads](https://img.shields.io/packagist/dt/happyr/entity-exists-validation-constraint.svg?style=flat-square)](https://packagist.org/packages/happyr/entity-exists-validation-constraint)
9+

composer.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"name": "happyr/entity-exists-validation-constraint",
3+
"description": "Verify that your entity exists",
4+
"type": "library",
5+
"license": "MIT",
6+
"authors": [
7+
{
8+
"name": "Radoje Albijanic",
9+
"email": "[email protected]"
10+
},
11+
{
12+
"name": "Tobias Nyholm",
13+
"email": "[email protected]"
14+
}
15+
],
16+
"require": {
17+
"php": "^7.2",
18+
"symfony/validator": "^3.4 || ^4.3"
19+
},
20+
"require-dev": {
21+
"symfony/phpunit-bridge": "^4.3"
22+
},
23+
"autoload": {
24+
"psr-4": {
25+
"Happyr\\Validator\\Constraint\\": "src/"
26+
}
27+
},
28+
"autoload-dev": {
29+
"psr-4": {
30+
"Tests\\Happyr\\Validator\\Constraint\\": "tests/"
31+
}
32+
}
33+
}

phpunit.xml.dist

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<phpunit backupGlobals="false"
4+
backupStaticAttributes="false"
5+
colors="false"
6+
convertErrorsToExceptions="true"
7+
convertNoticesToExceptions="true"
8+
convertWarningsToExceptions="true"
9+
processIsolation="false"
10+
stopOnFailure="false"
11+
bootstrap="./vendor/autoload.php"
12+
>
13+
14+
<php>
15+
<env name="ENV" value="test" />
16+
</php>
17+
18+
<testsuites>
19+
<testsuite name="Test Suite">
20+
<directory>./tests</directory>
21+
</testsuite>
22+
</testsuites>
23+
24+
<filter>
25+
<whitelist>
26+
<directory suffix=".php">./</directory>
27+
<exclude>
28+
<directory>vendor</directory>
29+
<directory>tests</directory>
30+
</exclude>
31+
</whitelist>
32+
</filter>
33+
</phpunit>

src/EntityExist.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Happyr\Validator\Constraint;
6+
7+
use Symfony\Component\Validator\Constraint;
8+
9+
/**
10+
* @Annotation
11+
*
12+
* @author Radoje Albijanic <[email protected]>
13+
*/
14+
final class EntityExist extends Constraint
15+
{
16+
public $message = 'Entity "%entity%" with property "%property%": "%value%" does not exist.';
17+
public $property = 'id';
18+
public $entity;
19+
}

0 commit comments

Comments
 (0)