-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ivan Wolf
committed
Jul 7, 2015
1 parent
10c01fa
commit 1f459aa
Showing
29 changed files
with
619 additions
and
2 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,2 @@ | ||
src_dir: src | ||
service_name: travis-ci |
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 @@ | ||
* text eol=lf |
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,4 @@ | ||
vendor | ||
composer.lock | ||
composer.phar | ||
phpunit.xml |
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,23 @@ | ||
language: php | ||
|
||
php: | ||
- 5.4 | ||
- 5.5 | ||
- 5.6 | ||
- hhvm | ||
|
||
matrix: | ||
allow_failures: | ||
- php: hhvm | ||
|
||
before_script: | ||
- composer self-update | ||
- composer install --dev --prefer-source --no-interaction | ||
|
||
script: | ||
- php vendor/bin/phpunit -c travis.phpunit.xml | ||
- php vendor/bin/phpmd src xml build/config/phpmd.xml --reportfile build/logs/pmd.xml | ||
- php vendor/bin/phpcs --report=checkstyle --report-file=build/logs/checkstyle.xml --standard=build/config/phpcs.xml -v ./src/ ./tests/ | ||
|
||
after_script: | ||
- php vendor/bin/coveralls |
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 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2014 DETAIL NET | ||
|
||
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,7 @@ | ||
<?php | ||
/** | ||
* This file is placed here for compatibility with Zend Framework 2's ModuleManager. | ||
* It allows usage of this module even without composer. | ||
* The original Module.php is in 'src/Detail/Persistence' in order to respect PSR-0. | ||
*/ | ||
require_once __DIR__ . '/src/Detail/Persistence/Module.php'; |
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 |
---|---|---|
@@ -1,2 +1,45 @@ | ||
# dfw-persistence-module | ||
Zend Framework 2 Module for Doctrine based persistence | ||
# Zend Framework 2 Module for Doctrine based persistence | ||
|
||
[![Build Status](https://travis-ci.org/detailnet/dfw-persistence-module.svg?branch=master)](https://travis-ci.org/detailnet/dfw-persistence-module) | ||
[![Coverage Status](https://img.shields.io/coveralls/detailnet/dfw-persistence-module.svg)](https://coveralls.io/r/detailnet/dfw-persistence-module) | ||
[![Latest Stable Version](https://poser.pugx.org/detailnet/dfw-persistence-module/v/stable.svg)](https://packagist.org/packages/detailnet/dfw-persistence-module) | ||
[![Latest Unstable Version](https://poser.pugx.org/detailnet/dfw-persistence-module/v/unstable.svg)](https://packagist.org/packages/detailnet/dfw-persistence-module) | ||
|
||
## Introduction | ||
This module provides useful classes for building a [Zend Framework 2](https://github.com/zendframework/zf2) application with a persistance layer based on [Doctrine](https://github.com/doctrine). | ||
|
||
## Requirements | ||
[Zend Framework 2 Skeleton Application](http://www.github.com/zendframework/ZendSkeletonApplication) (or compatible architecture) | ||
|
||
## Installation | ||
Install the module through [Composer](http://getcomposer.org/) using the following steps: | ||
|
||
1. `cd my/project/directory` | ||
|
||
2. Create a `composer.json` file with following contents (or update your existing file accordingly): | ||
|
||
```json | ||
{ | ||
"require": { | ||
"detailnet/dfw-persistence-module": "1.x-dev" | ||
} | ||
} | ||
``` | ||
3. Install Composer via `curl -s http://getcomposer.org/installer | php` (on Windows, download | ||
the [installer](http://getcomposer.org/installer) and execute it with PHP) | ||
|
||
4. Run `php composer.phar self-update` | ||
|
||
5. Run `php composer.phar install` | ||
|
||
6. Open `configs/application.config.php` and add following key to your `modules`: | ||
|
||
```php | ||
'Detail\Persistence', | ||
``` | ||
|
||
7. Copy `vendor/detailnet/dfw-persistence-module/config/detail_persistence.local.php.dist` into your application's | ||
`config/autoload` directory, rename it to `detail_persistence.local.php` and make the appropriate changes. | ||
|
||
## Usage | ||
tbd |
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,5 @@ | ||
* | ||
!config | ||
!config/* | ||
!logs | ||
!.gitignore |
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,31 @@ | ||
<?xml version="1.0"?> | ||
<ruleset name="DETAIL NET PHPCS rule set"> | ||
<description>The coding standard for a DETAIL NET PHP application</description> | ||
<exclude-pattern>*/img/*</exclude-pattern> | ||
<exclude-pattern>*/images/*</exclude-pattern> | ||
<exclude-pattern>*/less/*</exclude-pattern> | ||
<exclude-pattern>*/css/*</exclude-pattern> | ||
<exclude-pattern>*/js/*</exclude-pattern> | ||
<exclude-pattern>*.html</exclude-pattern> | ||
<exclude-pattern>*.twig</exclude-pattern> | ||
<exclude-pattern>*.yml</exclude-pattern> | ||
<exclude-pattern>*.xml</exclude-pattern> | ||
<exclude-pattern>*.txt</exclude-pattern> | ||
<exclude-pattern>*.less</exclude-pattern> | ||
<exclude-pattern>*.css</exclude-pattern> | ||
<exclude-pattern>*.js</exclude-pattern> | ||
<exclude-pattern>*.jpg</exclude-pattern> | ||
<exclude-pattern>*.jpeg</exclude-pattern> | ||
<exclude-pattern>*.png</exclude-pattern> | ||
<exclude-pattern>*.gif</exclude-pattern> | ||
|
||
<!-- Include the whole PSR-2 standard --> | ||
<rule ref="PSR2"/> | ||
<rule ref="Generic.Files.LineLength"> | ||
<properties> | ||
<property name="lineLimit" value="140"/> | ||
<property name="absoluteLineLimit" value="0"/> | ||
</properties> | ||
</rule> | ||
|
||
</ruleset> |
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,56 @@ | ||
<?xml version="1.0"?> | ||
<ruleset name="DETAIL NET PHPMD rule set" | ||
xmlns="http://pmd.sf.net/ruleset/1.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd" | ||
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd"> | ||
|
||
<description>Ruleset for all DETAIL NET projects</description> | ||
|
||
<rule ref="rulesets/unusedcode.xml" /> | ||
|
||
<rule ref="rulesets/design.xml"> | ||
<exclude name="CouplingBetweenObjects"/> | ||
</rule> | ||
|
||
<rule ref="rulesets/naming.xml"> | ||
<exclude name="ShortVariable"/> | ||
<exclude name="LongVariable"/> | ||
<exclude name="BooleanGetMethodName"/> | ||
</rule> | ||
<rule ref="rulesets/naming.xml/ShortVariable"> | ||
<properties> | ||
<property name="minimum" value="2" /> | ||
</properties> | ||
</rule> | ||
<rule ref="rulesets/naming.xml/LongVariable"> | ||
<properties> | ||
<property name="maximum" value="30" /> | ||
</properties> | ||
</rule> | ||
|
||
<rule ref="rulesets/codesize.xml"> | ||
<exclude name="TooManyMethods"/> | ||
<exclude name="ExcessiveClassComplexity"/> | ||
<exclude name="NPathComplexity"/> | ||
</rule> | ||
<rule ref="rulesets/codesize.xml/TooManyMethods"> | ||
<properties> | ||
<property name="maxmethods" value="20" /> | ||
</properties> | ||
</rule> | ||
<rule ref="rulesets/codesize.xml/ExcessiveClassComplexity"> | ||
<properties> | ||
<property name="maximum" value="70" /> | ||
</properties> | ||
</rule> | ||
<rule ref="rulesets/codesize.xml/NPathComplexity"> | ||
<properties> | ||
<property name="minimum" value="300" /> | ||
</properties> | ||
</rule> | ||
|
||
<rule ref="rulesets/controversial.xml"> | ||
<exclude name="Superglobals"/> | ||
</rule> | ||
</ruleset> |
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,2 @@ | ||
* | ||
!.gitignore |
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,63 @@ | ||
{ | ||
"name": "detailnet/dfw-persistence-module", | ||
"description": "Zend Framework 2 Module for Doctrine based persistence", | ||
"type": "library", | ||
"keywords": [ | ||
"dfw", | ||
"detailnet", | ||
"doctrine", | ||
"module", | ||
"zf2", | ||
"persistence" | ||
], | ||
"homepage": "https://github.com/detailnet/dfw-persistence-module/", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Ivan Wolf", | ||
"email": "ivan.wolf@detailnet.ch" | ||
} | ||
], | ||
"require": { | ||
"php": ">=5.4.0", | ||
"zendframework/zend-config": "2.*", | ||
"zendframework/zend-loader": "2.*", | ||
"zendframework/zend-modulemanager": "2.*", | ||
"zendframework/zend-mvc": "2.*", | ||
"zendframework/zend-servicemanager": "2.*", | ||
"detailnet/dfw-core": "~0.1.1" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "~4.6", | ||
"squizlabs/php_codesniffer" : "~2.3", | ||
"phpmd/phpmd": "~2.2", | ||
"satooshi/php-coveralls": "dev-master" | ||
}, | ||
"autoload": { | ||
"psr-0": { | ||
"Detail\\Persistence\\": "src/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-0": { | ||
"DetailTest\\Persistence\\": "tests/" | ||
} | ||
}, | ||
"extra": { | ||
"branch-alias": { | ||
"dev-master": "1.x-dev" | ||
} | ||
}, | ||
"archive": { | ||
"exclude": [ | ||
"!vendor", | ||
"tests", | ||
"*phpunit.xml", | ||
".coveralls.yml", | ||
".travis.yml", | ||
"build.xml", | ||
"build.properties", | ||
"composer.phar" | ||
] | ||
} | ||
} |
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 @@ | ||
<?php | ||
|
||
return array( | ||
'detail_persistence' => array( | ||
), | ||
); |
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 @@ | ||
<?php | ||
|
||
return array( | ||
'service_manager' => array( | ||
'abstract_factories' => array( | ||
), | ||
'aliases' => array( | ||
), | ||
'invokables' => array( | ||
), | ||
'factories' => array( | ||
'Detail\Persistence\Options\ModuleOptions' => 'Detail\Persistence\Factory\Options\ModuleOptionsFactory', | ||
), | ||
'initializers' => array( | ||
), | ||
'shared' => array( | ||
), | ||
), | ||
'detail_persistence' => array( | ||
), | ||
); |
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,29 @@ | ||
<phpunit | ||
bootstrap="./tests/bootstrap.php" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
verbose="true" | ||
stopOnFailure="false" | ||
processIsolation="false" | ||
backupGlobals="false" | ||
syntaxCheck="true" | ||
> | ||
<testsuite name="Detail\Persistence Test Suite"> | ||
<directory>./tests/DetailTest/Persistence</directory> | ||
</testsuite> | ||
|
||
<filter> | ||
<whitelist> | ||
<directory suffix=".php">./src</directory> | ||
</whitelist> | ||
</filter> | ||
|
||
<logging> | ||
<log type="coverage-text" target="php://stdout" showUncoveredFiles="true"/> | ||
<log type="coverage-html" target="./build/coverage" title="Detail\Persistence" charset="UTF-8" yui="true" highlight="true" lowUpperBound="35" highLowerBound="70"/> | ||
<log type="coverage-clover" target="./build/logs/clover.xml"/> | ||
<log type="junit" target="./build/logs/junit.xml" logIncompleteSkipped="false"/> | ||
</logging> | ||
</phpunit> |
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,7 @@ | ||
<?php | ||
|
||
namespace Detail\Persistence\Exception; | ||
|
||
class ConfigException extends RuntimeException | ||
{ | ||
} |
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,7 @@ | ||
<?php | ||
|
||
namespace Detail\Persistence\Exception; | ||
|
||
interface ExceptionInterface | ||
{ | ||
} |
8 changes: 8 additions & 0 deletions
8
src/Detail/Persistence/Exception/InvalidArgumentException.php
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,8 @@ | ||
<?php | ||
|
||
namespace Detail\Persistence\Exception; | ||
|
||
class InvalidArgumentException extends \InvalidArgumentException implements | ||
ExceptionInterface | ||
{ | ||
} |
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,8 @@ | ||
<?php | ||
|
||
namespace Detail\Persistence\Exception; | ||
|
||
class RuntimeException extends \RuntimeException implements | ||
ExceptionInterface | ||
{ | ||
} |
27 changes: 27 additions & 0 deletions
27
src/Detail/Persistence/Factory/Options/ModuleOptionsFactory.php
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,27 @@ | ||
<?php | ||
|
||
namespace Detail\Persistence\Factory\Options; | ||
|
||
use Zend\ServiceManager\FactoryInterface; | ||
use Zend\ServiceManager\ServiceLocatorInterface; | ||
|
||
use Detail\Persistence\Exception\ConfigException; | ||
use Detail\Persistence\Options\ModuleOptions; | ||
|
||
class ModuleOptionsFactory implements FactoryInterface | ||
{ | ||
/** | ||
* {@inheritDoc} | ||
* @return ModuleOptions | ||
*/ | ||
public function createService(ServiceLocatorInterface $serviceLocator) | ||
{ | ||
$config = $serviceLocator->get('Config'); | ||
|
||
if (!isset($config['detail_persistence'])) { | ||
throw new ConfigException('Config for Detail\Persistence is not set'); | ||
} | ||
|
||
return new ModuleOptions($config['detail_persistence']); | ||
} | ||
} |
Oops, something went wrong.