From 480cc61ab0df2f5d198ea05d0e87d54cb7fe6198 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Mo=CC=88ller?= Date: Sat, 26 Sep 2015 11:56:40 +0200 Subject: [PATCH 01/11] Enhancement: Require doctrine/doctrine-module --- composer.json | 5 +- composer.lock | 621 ++++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 552 insertions(+), 74 deletions(-) diff --git a/composer.json b/composer.json index aa17b02b..8dc517c4 100644 --- a/composer.json +++ b/composer.json @@ -4,12 +4,13 @@ "license": "BSD-3-Clause", "homepage": "https://zfmodules.com", "require": { - "evandotpro/edp-github": "0.2.*", + "php": "~5.5", "ext-intl": "*", + "doctrine/doctrine-module": "^0.9.0", + "evandotpro/edp-github": "0.2.*", "ezyang/htmlpurifier": "4.6.*", "monolog/monolog": "~1.12", "phing/phing": "~2.10", - "php": "~5.5", "socalnick/scn-social-auth": "1.14.1", "zendframework/zendframework": "~2.3.0", "zf-commons/zfc-user": "1.0.*", diff --git a/composer.lock b/composer.lock index 7704687d..43902b94 100644 --- a/composer.lock +++ b/composer.lock @@ -4,9 +4,485 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "20515c2c7353798b7f39a326e3ea95da", - "content-hash": "b19e31ca7d86a53a73da2e8c3ff1e494", + "hash": "c379f93569f3b56ed1ed107112d0fa78", + "content-hash": "bc08f407b7b10ad4d4b60bc9c36f3384", "packages": [ + { + "name": "doctrine/annotations", + "version": "v1.2.7", + "source": { + "type": "git", + "url": "https://github.com/doctrine/annotations.git", + "reference": "f25c8aab83e0c3e976fd7d19875f198ccf2f7535" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/f25c8aab83e0c3e976fd7d19875f198ccf2f7535", + "reference": "f25c8aab83e0c3e976fd7d19875f198ccf2f7535", + "shasum": "" + }, + "require": { + "doctrine/lexer": "1.*", + "php": ">=5.3.2" + }, + "require-dev": { + "doctrine/cache": "1.*", + "phpunit/phpunit": "4.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Annotations\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Docblock Annotations Parser", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "docblock", + "parser" + ], + "time": "2015-08-31 12:32:49" + }, + { + "name": "doctrine/cache", + "version": "v1.4.2", + "source": { + "type": "git", + "url": "https://github.com/doctrine/cache.git", + "reference": "8c434000f420ade76a07c64cbe08ca47e5c101ca" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/cache/zipball/8c434000f420ade76a07c64cbe08ca47e5c101ca", + "reference": "8c434000f420ade76a07c64cbe08ca47e5c101ca", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "conflict": { + "doctrine/common": ">2.2,<2.4" + }, + "require-dev": { + "phpunit/phpunit": ">=3.7", + "predis/predis": "~1.0", + "satooshi/php-coveralls": "~0.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.5.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Cache\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Caching library offering an object-oriented API for many cache backends", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "cache", + "caching" + ], + "time": "2015-08-31 12:36:41" + }, + { + "name": "doctrine/collections", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/collections.git", + "reference": "6c1e4eef75f310ea1b3e30945e9f06e652128b8a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/collections/zipball/6c1e4eef75f310ea1b3e30945e9f06e652128b8a", + "reference": "6c1e4eef75f310ea1b3e30945e9f06e652128b8a", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Collections\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Collections Abstraction library", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "array", + "collections", + "iterator" + ], + "time": "2015-04-14 22:21:58" + }, + { + "name": "doctrine/common", + "version": "v2.5.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/common.git", + "reference": "0009b8f0d4a917aabc971fb089eba80e872f83f9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/common/zipball/0009b8f0d4a917aabc971fb089eba80e872f83f9", + "reference": "0009b8f0d4a917aabc971fb089eba80e872f83f9", + "shasum": "" + }, + "require": { + "doctrine/annotations": "1.*", + "doctrine/cache": "1.*", + "doctrine/collections": "1.*", + "doctrine/inflector": "1.*", + "doctrine/lexer": "1.*", + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "~3.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Common Library for Doctrine projects", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "collections", + "eventmanager", + "persistence", + "spl" + ], + "time": "2015-08-31 13:00:22" + }, + { + "name": "doctrine/doctrine-module", + "version": "0.9.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/DoctrineModule.git", + "reference": "81fd6a95609d88c2a059117ba18346240f2cc8d2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/DoctrineModule/zipball/81fd6a95609d88c2a059117ba18346240f2cc8d2", + "reference": "81fd6a95609d88c2a059117ba18346240f2cc8d2", + "shasum": "" + }, + "require": { + "doctrine/common": ">=2.4,<2.6-dev", + "php": ">=5.4", + "symfony/console": "~2.3|~3.0", + "zendframework/zend-authentication": "~2.3", + "zendframework/zend-cache": "~2.3", + "zendframework/zend-mvc": "~2.3", + "zendframework/zend-paginator": "~2.3", + "zendframework/zend-servicemanager": "~2.3", + "zendframework/zend-stdlib": "~2.3", + "zendframework/zend-validator": "~2.3" + }, + "require-dev": { + "doctrine/coding-standard": "dev-master", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~2", + "zendframework/zendframework": "~2.3" + }, + "suggest": { + "doctrine/data-fixtures": "Data Fixtures if you want to generate test data or bootstrap data for your deployments" + }, + "bin": [ + "bin/doctrine-module" + ], + "type": "library", + "autoload": { + "psr-0": { + "DoctrineModule\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kyle Spraggs", + "email": "theman@spiffyjr.me", + "homepage": "http://www.spiffyjr.me/" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@hotmail.com" + }, + { + "name": "Michaƫl Gallego", + "email": "mic.gallego@gmail.com", + "homepage": "http://www.michaelgallego.fr" + }, + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://marco-pivetta.com/" + } + ], + "description": "Zend Framework 2 Module that provides Doctrine basic functionality required for ORM and ODM modules", + "homepage": "http://www.doctrine-project.org/", + "keywords": [ + "doctrine", + "module", + "zf2" + ], + "time": "2015-07-14 16:36:19" + }, + { + "name": "doctrine/inflector", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/inflector.git", + "reference": "0bcb2e79d8571787f18b7eb036ed3d004908e604" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/0bcb2e79d8571787f18b7eb036ed3d004908e604", + "reference": "0bcb2e79d8571787f18b7eb036ed3d004908e604", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "4.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Inflector\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Common String Manipulations with regard to casing and singular/plural rules.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "inflection", + "pluralize", + "singularize", + "string" + ], + "time": "2014-12-20 21:24:13" + }, + { + "name": "doctrine/lexer", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Lexer\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "lexer", + "parser" + ], + "time": "2014-09-09 13:34:57" + }, { "name": "evandotpro/edp-github", "version": "0.2.0", @@ -415,6 +891,63 @@ ], "time": "2014-06-06 01:43:05" }, + { + "name": "symfony/console", + "version": "v2.7.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "9ff9032151186bd66ecee727d728f1319f52d1d8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/9ff9032151186bd66ecee727d728f1319f52d1d8", + "reference": "9ff9032151186bd66ecee727d728f1319f52d1d8", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/event-dispatcher": "~2.1", + "symfony/phpunit-bridge": "~2.7", + "symfony/process": "~2.1" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Console Component", + "homepage": "https://symfony.com", + "time": "2015-09-03 11:40:38" + }, { "name": "zendframework/zendframework", "version": "2.3.5", @@ -875,22 +1408,23 @@ }, { "name": "fabpot/php-cs-fixer", - "version": "v1.5", + "version": "v1.10.1", "source": { "type": "git", "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "2d6851520bf0250f668307ab2fd28cbb0b35d2b9" + "reference": "12dbcd1462f1e3a5a96c6c7398af26b28e092a8a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/2d6851520bf0250f668307ab2fd28cbb0b35d2b9", - "reference": "2d6851520bf0250f668307ab2fd28cbb0b35d2b9", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/12dbcd1462f1e3a5a96c6c7398af26b28e092a8a", + "reference": "12dbcd1462f1e3a5a96c6c7398af26b28e092a8a", "shasum": "" }, "require": { + "ext-tokenizer": "*", "php": ">=5.3.6", "sebastian/diff": "~1.1", - "symfony/console": "~2.1", + "symfony/console": "~2.3", "symfony/event-dispatcher": "~2.1", "symfony/filesystem": "~2.1", "symfony/finder": "~2.1", @@ -923,8 +1457,8 @@ "email": "fabien@symfony.com" } ], - "description": "A script to automatically fix Symfony Coding Standard", - "time": "2015-02-18 19:35:59" + "description": "A tool to automatically fix PHP code style", + "time": "2015-10-12 20:13:46" }, { "name": "fzaninotto/faker", @@ -1822,74 +2356,17 @@ "homepage": "https://github.com/sebastianbergmann/version", "time": "2015-06-21 13:59:46" }, - { - "name": "symfony/console", - "version": "v2.7.4", - "source": { - "type": "git", - "url": "https://github.com/symfony/Console.git", - "reference": "9ff9032151186bd66ecee727d728f1319f52d1d8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Console/zipball/9ff9032151186bd66ecee727d728f1319f52d1d8", - "reference": "9ff9032151186bd66ecee727d728f1319f52d1d8", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/event-dispatcher": "~2.1", - "symfony/phpunit-bridge": "~2.7", - "symfony/process": "~2.1" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/process": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Console\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Console Component", - "homepage": "https://symfony.com", - "time": "2015-09-03 11:40:38" - }, { "name": "symfony/event-dispatcher", "version": "v2.7.4", "source": { "type": "git", - "url": "https://github.com/symfony/EventDispatcher.git", + "url": "https://github.com/symfony/event-dispatcher.git", "reference": "b58c916f1db03a611b72dd702564f30ad8fe83fa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/b58c916f1db03a611b72dd702564f30ad8fe83fa", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/b58c916f1db03a611b72dd702564f30ad8fe83fa", "reference": "b58c916f1db03a611b72dd702564f30ad8fe83fa", "shasum": "" }, @@ -1942,12 +2419,12 @@ "version": "v2.7.4", "source": { "type": "git", - "url": "https://github.com/symfony/Filesystem.git", + "url": "https://github.com/symfony/filesystem.git", "reference": "f079e9933799929584200b9a926f72f29e291654" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Filesystem/zipball/f079e9933799929584200b9a926f72f29e291654", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/f079e9933799929584200b9a926f72f29e291654", "reference": "f079e9933799929584200b9a926f72f29e291654", "shasum": "" }, @@ -2381,8 +2858,8 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "ext-intl": "*", - "php": "~5.5" + "php": "~5.5", + "ext-intl": "*" }, "platform-dev": [] } From 05379268ca12f383b951f7ad1dd5723612ce5ea2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Mo=CC=88ller?= Date: Sat, 26 Sep 2015 12:00:47 +0200 Subject: [PATCH 02/11] Enhancement: Require doctrine/doctrine-orm-module --- composer.json | 1 + composer.lock | 338 +++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 283 insertions(+), 56 deletions(-) diff --git a/composer.json b/composer.json index 8dc517c4..10f41bb7 100644 --- a/composer.json +++ b/composer.json @@ -7,6 +7,7 @@ "php": "~5.5", "ext-intl": "*", "doctrine/doctrine-module": "^0.9.0", + "doctrine/doctrine-orm-module": "^0.9.2", "evandotpro/edp-github": "0.2.*", "ezyang/htmlpurifier": "4.6.*", "monolog/monolog": "~1.12", diff --git a/composer.lock b/composer.lock index 43902b94..19207541 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "c379f93569f3b56ed1ed107112d0fa78", - "content-hash": "bc08f407b7b10ad4d4b60bc9c36f3384", + "hash": "6fcfffbd7c192072fae657ee5ebeabf6", + "content-hash": "0a3fd61e0afc3c24e4cb76a66828dd40", "packages": [ { "name": "doctrine/annotations", @@ -284,6 +284,77 @@ ], "time": "2015-08-31 13:00:22" }, + { + "name": "doctrine/dbal", + "version": "v2.5.2", + "source": { + "type": "git", + "url": "https://github.com/doctrine/dbal.git", + "reference": "01dbcbc5cd0a913d751418e635434a18a2f2a75c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/01dbcbc5cd0a913d751418e635434a18a2f2a75c", + "reference": "01dbcbc5cd0a913d751418e635434a18a2f2a75c", + "shasum": "" + }, + "require": { + "doctrine/common": ">=2.4,<2.6-dev", + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "4.*", + "symfony/console": "2.*" + }, + "suggest": { + "symfony/console": "For helpful console commands such as SQL execution and import of files." + }, + "bin": [ + "bin/doctrine-dbal" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.5.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\DBAL\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + } + ], + "description": "Database Abstraction Layer", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "database", + "dbal", + "persistence", + "queryobject" + ], + "time": "2015-09-16 16:29:33" + }, { "name": "doctrine/doctrine-module", "version": "0.9.0", @@ -362,6 +433,84 @@ ], "time": "2015-07-14 16:36:19" }, + { + "name": "doctrine/doctrine-orm-module", + "version": "0.9.2", + "source": { + "type": "git", + "url": "https://github.com/doctrine/DoctrineORMModule.git", + "reference": "847db36f0f7ef8d940414e433e8b241aa601a6a7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/DoctrineORMModule/zipball/847db36f0f7ef8d940414e433e8b241aa601a6a7", + "reference": "847db36f0f7ef8d940414e433e8b241aa601a6a7", + "shasum": "" + }, + "require": { + "doctrine/dbal": ">=2.4,<2.7", + "doctrine/doctrine-module": "~0.8", + "doctrine/orm": ">=2.5,<2.7", + "php": ">=5.4", + "symfony/console": "~2.5|~3.0", + "zendframework/zend-mvc": "~2.3", + "zendframework/zend-servicemanager": "~2.3", + "zendframework/zend-stdlib": "~2.3" + }, + "require-dev": { + "doctrine/data-fixtures": "1.0.*", + "doctrine/migrations": "1.0.*@dev", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~2", + "zendframework/zend-developer-tools": "*", + "zendframework/zendframework": "~2.3" + }, + "suggest": { + "doctrine/migrations": "doctrine migrations if you want to keep your schema definitions versioned", + "zendframework/zend-developer-tools": "zend-developer-tools if you want to profile operations executed by the ORM during development", + "zendframework/zend-form": "if you want to use form elements backed by Doctrine" + }, + "type": "library", + "autoload": { + "psr-0": { + "DoctrineORMModule\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kyle Spraggs", + "email": "theman@spiffyjr.me", + "homepage": "http://www.spiffyjr.me/" + }, + { + "name": "Evan Coury", + "email": "me@evancoury.com", + "homepage": "http://blog.evan.pro/" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@hotmail.com" + }, + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://marco-pivetta.com/" + } + ], + "description": "Zend Framework 2 Module that provides Doctrine ORM functionality", + "homepage": "http://www.doctrine-project.org/", + "keywords": [ + "doctrine", + "module", + "orm", + "zf2" + ], + "time": "2015-10-05 23:06:08" + }, { "name": "doctrine/inflector", "version": "v1.0.1", @@ -429,6 +578,60 @@ ], "time": "2014-12-20 21:24:13" }, + { + "name": "doctrine/instantiator", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", + "shasum": "" + }, + "require": { + "php": ">=5.3,<8.0-DEV" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://github.com/doctrine/instantiator", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2015-06-14 21:17:01" + }, { "name": "doctrine/lexer", "version": "v1.0.1", @@ -483,6 +686,83 @@ ], "time": "2014-09-09 13:34:57" }, + { + "name": "doctrine/orm", + "version": "v2.5.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/doctrine2.git", + "reference": "e6a83bedbe67579cb0bfb688e982e617943a2945" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/doctrine2/zipball/e6a83bedbe67579cb0bfb688e982e617943a2945", + "reference": "e6a83bedbe67579cb0bfb688e982e617943a2945", + "shasum": "" + }, + "require": { + "doctrine/cache": "~1.4", + "doctrine/collections": "~1.2", + "doctrine/common": ">=2.5-dev,<2.6-dev", + "doctrine/dbal": ">=2.5-dev,<2.6-dev", + "doctrine/instantiator": "~1.0.1", + "ext-pdo": "*", + "php": ">=5.4", + "symfony/console": "~2.5" + }, + "require-dev": { + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", + "symfony/yaml": "~2.1" + }, + "suggest": { + "symfony/yaml": "If you want to use YAML Metadata Mapping Driver" + }, + "bin": [ + "bin/doctrine", + "bin/doctrine.php" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\ORM\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + } + ], + "description": "Object-Relational-Mapper for PHP", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "database", + "orm" + ], + "time": "2015-08-31 12:59:39" + }, { "name": "evandotpro/edp-github", "version": "0.2.0", @@ -1352,60 +1632,6 @@ ], "time": "2014-03-11 13:42:24" }, - { - "name": "doctrine/instantiator", - "version": "1.0.5", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", - "shasum": "" - }, - "require": { - "php": ">=5.3,<8.0-DEV" - }, - "require-dev": { - "athletic/athletic": "~0.1.8", - "ext-pdo": "*", - "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", - "keywords": [ - "constructor", - "instantiate" - ], - "time": "2015-06-14 21:17:01" - }, { "name": "fabpot/php-cs-fixer", "version": "v1.10.1", From bead7d59a1b9073623ba156687ffd0049fec47c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Mo=CC=88ller?= Date: Sat, 26 Sep 2015 12:02:12 +0200 Subject: [PATCH 03/11] Enhancement: Require doctrine/migrations --- composer.json | 3 +- composer.lock | 169 +++++++++++++++++++++++++++++++++++--------------- 2 files changed, 120 insertions(+), 52 deletions(-) diff --git a/composer.json b/composer.json index 10f41bb7..819be16f 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,8 @@ "php": "~5.5", "ext-intl": "*", "doctrine/doctrine-module": "^0.9.0", - "doctrine/doctrine-orm-module": "^0.9.2", + "doctrine/doctrine-orm-module": "^0.9.1", + "doctrine/migrations": "^1.1", "evandotpro/edp-github": "0.2.*", "ezyang/htmlpurifier": "4.6.*", "monolog/monolog": "~1.12", diff --git a/composer.lock b/composer.lock index 19207541..faee489e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "6fcfffbd7c192072fae657ee5ebeabf6", - "content-hash": "0a3fd61e0afc3c24e4cb76a66828dd40", + "hash": "352f7f1b2ce7cd85628f4d51fd027dd6", + "content-hash": "e3cd828fa33a790b035b1a5a65555d01", "packages": [ { "name": "doctrine/annotations", @@ -686,6 +686,73 @@ ], "time": "2014-09-09 13:34:57" }, + { + "name": "doctrine/migrations", + "version": "v1.1.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/migrations.git", + "reference": "d196ddc229f50c66c5a015c158adb78a2dfb4351" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/migrations/zipball/d196ddc229f50c66c5a015c158adb78a2dfb4351", + "reference": "d196ddc229f50c66c5a015c158adb78a2dfb4351", + "shasum": "" + }, + "require": { + "doctrine/dbal": "~2.2", + "php": ">=5.4.0", + "symfony/console": "~2.3", + "symfony/yaml": "~2.3" + }, + "require-dev": { + "doctrine/coding-standard": "dev-master", + "doctrine/orm": "2.*", + "johnkary/phpunit-speedtrap": "~1.0@dev", + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "~4.7", + "satooshi/php-coveralls": "0.6.*" + }, + "suggest": { + "symfony/console": "to run the migration from the console" + }, + "bin": [ + "bin/doctrine-migrations" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "v1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\DBAL\\Migrations\\": "lib/Doctrine/DBAL/Migrations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-2.1" + ], + "authors": [ + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + } + ], + "description": "Database Schema migrations using Doctrine DBAL", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "database", + "migrations" + ], + "time": "2015-09-29 11:13:06" + }, { "name": "doctrine/orm", "version": "v2.5.1", @@ -1228,6 +1295,55 @@ "homepage": "https://symfony.com", "time": "2015-09-03 11:40:38" }, + { + "name": "symfony/yaml", + "version": "v2.7.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/Yaml.git", + "reference": "2dc7b06c065df96cc686c66da2705e5e18aef661" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/2dc7b06c065df96cc686c66da2705e5e18aef661", + "reference": "2dc7b06c065df96cc686c66da2705e5e18aef661", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Yaml Component", + "homepage": "https://symfony.com", + "time": "2015-08-24 07:13:45" + }, { "name": "zendframework/zendframework", "version": "2.3.5", @@ -2836,55 +2952,6 @@ "homepage": "https://symfony.com", "time": "2015-08-24 07:13:45" }, - { - "name": "symfony/yaml", - "version": "v2.7.4", - "source": { - "type": "git", - "url": "https://github.com/symfony/Yaml.git", - "reference": "2dc7b06c065df96cc686c66da2705e5e18aef661" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/2dc7b06c065df96cc686c66da2705e5e18aef661", - "reference": "2dc7b06c065df96cc686c66da2705e5e18aef661", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com", - "time": "2015-08-24 07:13:45" - }, { "name": "zendframework/zend-developer-tools", "version": "dev-master", From edb8b66397296d96ce44d045728cf19573dfc097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Mo=CC=88ller?= Date: Sat, 26 Sep 2015 12:08:34 +0200 Subject: [PATCH 04/11] Enhancement: Add basic configuration --- config/autoload/global.php | 21 +++++++++++++++++++++ config/autoload/travis.php.local.dist | 13 +++++++++++++ 2 files changed, 34 insertions(+) diff --git a/config/autoload/global.php b/config/autoload/global.php index e3aaec48..2c1ec246 100644 --- a/config/autoload/global.php +++ b/config/autoload/global.php @@ -14,4 +14,25 @@ 'username' => 'modules', 'password' => 'modules', ], + 'doctrine' => [ + 'connection' => [ + 'orm_default' => [ + 'params' => [ + 'host' => 'localhost', + 'port' => '3306', + 'user' => 'modules', + 'password' => 'modules', + 'dbname' => 'modules', + ], + ], + ], + 'migrations_configuration' => [ + 'orm_default' => [ + 'directory' => 'data/migrations', + 'name' => 'ZFModules DBAL Migrations', + 'namespace' => 'ZfModulesMigrations', + 'table' => 'doctrine_migration_versions', + ], + ], + ], ]; diff --git a/config/autoload/travis.php.local.dist b/config/autoload/travis.php.local.dist index d9bfa9e1..51111494 100644 --- a/config/autoload/travis.php.local.dist +++ b/config/autoload/travis.php.local.dist @@ -7,4 +7,17 @@ return [ 'username' => 'root', 'password' => '', ], + 'doctrine' => [ + 'connection' => [ + 'orm_default' => [ + 'params' => [ + 'host' => 'localhost', + 'port' => '3306', + 'user' => 'root', + 'password' => '', + 'dbname' => 'modules_test', + ], + ], + ], + ], ]; From eb972ad389325d9eb3df520197832364d020524e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Mo=CC=88ller?= Date: Sat, 26 Sep 2015 12:09:39 +0200 Subject: [PATCH 05/11] Enhancement: Enable DoctrineModule and DoctrineORMModule --- config/application.config.php | 2 ++ data/migrations/.gitkeep | 0 2 files changed, 2 insertions(+) create mode 100644 data/migrations/.gitkeep diff --git a/config/application.config.php b/config/application.config.php index 10b10a35..29180189 100644 --- a/config/application.config.php +++ b/config/application.config.php @@ -2,6 +2,8 @@ return [ 'modules' => [ + 'DoctrineModule', + 'DoctrineORMModule', 'ZF\DevelopmentMode', 'ZfcBase', 'ZfcUser', diff --git a/data/migrations/.gitkeep b/data/migrations/.gitkeep new file mode 100644 index 00000000..e69de29b From 8cfc92a4a1276a12d3dada266b55212a86801f32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Mo=CC=88ller?= Date: Sat, 26 Sep 2015 13:00:17 +0200 Subject: [PATCH 06/11] Enhancement: Extract Doctrine migration --- data/migrations/.gitkeep | 0 data/migrations/Version20150926125836.php | 125 ++++++++++++++++++++++ 2 files changed, 125 insertions(+) delete mode 100644 data/migrations/.gitkeep create mode 100644 data/migrations/Version20150926125836.php diff --git a/data/migrations/.gitkeep b/data/migrations/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/data/migrations/Version20150926125836.php b/data/migrations/Version20150926125836.php new file mode 100644 index 00000000..cb9aeadc --- /dev/null +++ b/data/migrations/Version20150926125836.php @@ -0,0 +1,125 @@ +addSql(' + CREATE TABLE IF NOT EXISTS `module` ( + `module_id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `description` text NOT NULL, + `url` varchar(500) NOT NULL, + `meta_data` blob, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `updated_at` timestamp NULL DEFAULT NULL, + `photo_url` varchar(255) DEFAULT NULL, + `owner` varchar(255) NOT NULL, + PRIMARY KEY (`module_id`) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + '); + + $this->addSql(' + CREATE TABLE IF NOT EXISTS `module_admin` ( + `user_id` int(11) NOT NULL, + `module_id` int(11) NOT NULL, + PRIMARY KEY (`user_id`,`module_id`), + KEY `module_id` (`module_id`), + CONSTRAINT `module_admin_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE, + CONSTRAINT `module_admin_ibfk_2` FOREIGN KEY (`module_id`) REFERENCES `module` (`module_id`) ON DELETE CASCADE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + '); + + $this->addSql(' + CREATE TABLE IF NOT EXISTS `user` ( + `user_id` int(11) NOT NULL AUTO_INCREMENT, + `username` varchar(255) DEFAULT NULL, + `email` varchar(255) DEFAULT NULL, + `display_name` varchar(50) DEFAULT NULL, + `password` varchar(128) NOT NULL, + `photo_url` varchar(255) DEFAULT NULL, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `state` int(2) DEFAULT NULL, + PRIMARY KEY (`user_id`), + UNIQUE KEY `username` (`username`), + UNIQUE KEY `email` (`email`) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + '); + + $this->addSql(' + CREATE TABLE IF NOT EXISTS `user_provider` ( + `user_id` int(11) NOT NULL, + `provider_id` varchar(50) NOT NULL, + `provider` varchar(255) NOT NULL, + PRIMARY KEY (`user_id`,`provider_id`), + UNIQUE KEY `provider_id` (`provider_id`,`provider`), + CONSTRAINT `user_provider_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + '); + } + + public function down(Schema $schema) + { + $tables = [ + 'module', + 'module_admin', + 'user', + 'user_provider', + ]; + + foreach ($tables as $table) { + $schema->dropTable($table); + } + } + + public function preUp(Schema $schema) + { + $this->pre(); + } + + public function postUp(Schema $schema) + { + $this->post(); + } + + public function preDown(Schema $schema) + { + $this->pre(); + } + + public function postDown(Schema $schema) + { + $this->post(); + } + + private function pre() + { + $this->addSql('SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT'); + $this->addSql('SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS'); + $this->addSql('SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION'); + $this->addSql('SET NAMES utf8'); + $this->addSql('SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0'); + $this->addSql("SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO'"); + $this->addSql('SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0'); + } + + private function post() + { + $this->addSql('SET SQL_NOTES=@OLD_SQL_NOTES'); + $this->addSql('SET SQL_MODE=@OLD_SQL_MODE'); + $this->addSql('SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS'); + $this->addSql('SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT'); + $this->addSql('SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS'); + $this->addSql('SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION'); + } +} From ea3490317354c61a5dee6de934ff26718fba856c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Mo=CC=88ller?= Date: Sat, 26 Sep 2015 13:03:21 +0200 Subject: [PATCH 07/11] Enhancement: Run migrations on Travis as well as in test target --- .travis.yml | 1 + Makefile | 1 + 2 files changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index b369b288..bdcf3d87 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,6 +27,7 @@ before_script: - cp config/autoload/travis.php.local.dist config/autoload/travis.local.php - mysql -uroot -e 'create database modules_test;' - mysql -uroot modules_test < data/sql/0.sql + - php public/index.php migrations:migrate --no-interaction --verbose script: - vendor/bin/php-cs-fixer fix --config-file=./.php_cs --dry-run --diff -v diff --git a/Makefile b/Makefile index 7593e94d..65426782 100644 --- a/Makefile +++ b/Makefile @@ -12,5 +12,6 @@ test: composer mysql -uroot -e 'DROP DATABASE IF EXISTS modules_test;' mysql -uroot -e 'CREATE DATABASE modules_test;' mysql -uroot modules_test < data/sql/0.sql + php public/index.php migrations:migrate --no-interaction --verbose vendor/bin/phpunit --configuration phpunit.xml rm config/autoload/travis.local.php From 62f474242134f1e5584582ceccbc32534aac0193 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Mo=CC=88ller?= Date: Sat, 26 Sep 2015 13:04:17 +0200 Subject: [PATCH 08/11] Fix: Remove database dump --- .travis.yml | 1 - Makefile | 1 - data/sql/0.sql | 102 ------------------------------------------------- 3 files changed, 104 deletions(-) delete mode 100644 data/sql/0.sql diff --git a/.travis.yml b/.travis.yml index bdcf3d87..dcaefcf5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,7 +26,6 @@ install: before_script: - cp config/autoload/travis.php.local.dist config/autoload/travis.local.php - mysql -uroot -e 'create database modules_test;' - - mysql -uroot modules_test < data/sql/0.sql - php public/index.php migrations:migrate --no-interaction --verbose script: diff --git a/Makefile b/Makefile index 65426782..b4f11655 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,6 @@ test: composer cp config/autoload/travis.php.local.dist config/autoload/travis.local.php mysql -uroot -e 'DROP DATABASE IF EXISTS modules_test;' mysql -uroot -e 'CREATE DATABASE modules_test;' - mysql -uroot modules_test < data/sql/0.sql php public/index.php migrations:migrate --no-interaction --verbose vendor/bin/phpunit --configuration phpunit.xml rm config/autoload/travis.local.php diff --git a/data/sql/0.sql b/data/sql/0.sql deleted file mode 100644 index 8cdba07d..00000000 --- a/data/sql/0.sql +++ /dev/null @@ -1,102 +0,0 @@ --- --- Database: `modules` --- - --- -------------------------------------------------------- - --- --- Table structure for table `module` --- - -CREATE TABLE IF NOT EXISTS `module` ( - `module_id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(255) NOT NULL, - `description` text NOT NULL, - `url` varchar(500) NOT NULL, - `meta_data` blob, - `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `updated_at` timestamp NULL DEFAULT NULL, - `photo_url` varchar(255) DEFAULT NULL, - `owner` varchar(255) NOT NULL, - PRIMARY KEY(`module_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; - --- -------------------------------------------------------- - --- --- Table structure for table `module_admin` --- - -CREATE TABLE IF NOT EXISTS `module_admin` ( - `user_id` int(11) NOT NULL, - `module_id` int(11) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Table structure for table `user` --- - -CREATE TABLE IF NOT EXISTS `user` ( - `user_id` int(11) NOT NULL AUTO_INCREMENT, - `username` varchar(255) DEFAULT NULL, - `email` varchar(255) DEFAULT NULL, - `display_name` varchar(50) DEFAULT NULL, - `password` varchar(128) NOT NULL, - `photo_url` varchar(255) DEFAULT NULL, - `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `state` int(2) DEFAULT NULL, - PRIMARY KEY(`user_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; - --- -------------------------------------------------------- - --- --- Table structure for table `user_provider` --- - -CREATE TABLE IF NOT EXISTS `user_provider` ( - `user_id` int(11) NOT NULL, - `provider_id` varchar(50) NOT NULL, - `provider` varchar(255) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- --- Indexes for dumped tables --- - --- --- Indexes for table `module_admin` --- -ALTER TABLE `module_admin` - ADD PRIMARY KEY (`user_id`,`module_id`), ADD KEY `module_id` (`module_id`); - --- --- Indexes for table `user` --- -ALTER TABLE `user` - ADD UNIQUE KEY `username` (`username`), ADD UNIQUE KEY `email` (`email`); - --- --- Indexes for table `user_provider` --- -ALTER TABLE `user_provider` - ADD PRIMARY KEY (`user_id`,`provider_id`), ADD UNIQUE KEY `provider_id` (`provider_id`,`provider`); - --- --- Constraints for dumped tables --- - --- --- Constraints for table `module_admin` --- -ALTER TABLE `module_admin` -ADD CONSTRAINT `module_admin_ibfk_2` FOREIGN KEY (`module_id`) REFERENCES `module` (`module_id`) ON DELETE CASCADE, -ADD CONSTRAINT `module_admin_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE; - --- --- Constraints for table `user_provider` --- -ALTER TABLE `user_provider` -ADD CONSTRAINT `user_provider_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`); From 4af812d8bfb86878906ead31fe8fac76bd0387b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Mo=CC=88ller?= Date: Sat, 26 Sep 2015 13:12:50 +0200 Subject: [PATCH 09/11] Enhancement: Assert that migrations can be rolled up and down --- .../DBAL/Migration/MigrationTest.php | 130 ++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 module/Application/test/ApplicationTest/Integration/DBAL/Migration/MigrationTest.php diff --git a/module/Application/test/ApplicationTest/Integration/DBAL/Migration/MigrationTest.php b/module/Application/test/ApplicationTest/Integration/DBAL/Migration/MigrationTest.php new file mode 100644 index 00000000..a5259be4 --- /dev/null +++ b/module/Application/test/ApplicationTest/Integration/DBAL/Migration/MigrationTest.php @@ -0,0 +1,130 @@ +migrateUpTo(); + } + + /** + * @dataProvider providerMigration + * + * @param string $identifier + * @param string $previousIdentifier + */ + public function testMigration($identifier, $previousIdentifier) + { + $this->migrateUpTo($previousIdentifier); + + $this->assertCanMigrateUpTo($identifier); + $this->assertCanMigrateDownFrom($identifier, $previousIdentifier); + } + + /** + * @return \Generator + */ + public function providerMigration() + { + $previousIdentifier = '0'; + + foreach ($this->getMigrationConfiguration()->getAvailableVersions() as $identifier) { + yield [ + $identifier, + $previousIdentifier, + ]; + + $previousIdentifier = $identifier; + }; + } + + /** + * Asserts that the migration with the specified version can be rolled back. + * + * @param string $identifier + * @param string $previousIdentifier + * + * @throws \Exception + */ + private function assertCanMigrateDownFrom($identifier, $previousIdentifier) + { + $version = $this->getMigrationConfiguration()->getVersion($identifier); + + try { + $version->execute('down'); + } catch (\Exception $exception) { + $this->fail(sprintf( + 'Failed asserting that the version "%s" can be rolled back from - %s', + $identifier, + $exception->getMessage() + )); + + throw $exception; + } + + $this->assertSame($previousIdentifier, $this->getMigrationConfiguration()->getCurrentVersion()); + } + + /** + * Asserts that the migration with the specified version can be rolled to. + * + * @param string $identifier + * + * @throws DBAL\Migrations\MigrationException + * @throws \Exception + */ + private function assertCanMigrateUpTo($identifier) + { + $version = $this->getMigrationConfiguration()->getVersion($identifier); + + try { + $version->execute('up'); + } catch (\Exception $exception) { + $this->fail(sprintf( + 'Failed asserting that the version "%s" can be rolled up to - %s', + $identifier, + $exception->getMessage() + )); + + throw $exception; + } + + $this->assertSame($identifier, $this->getMigrationConfiguration()->getCurrentVersion()); + } + + /** + * Ensure that the migration with the specified version has been migrated up to. + * + * @param string $identifier + */ + private function migrateUpTo($identifier = null) + { + $migration = new DBAL\Migrations\Migration($this->getMigrationConfiguration()); + $migration->migrate($identifier); + } + + /** + * @return DBAL\Migrations\Configuration\Configuration + */ + private function getMigrationConfiguration() + { + if ($this->configuration === null) { + $serviceManager = Bootstrap::getServiceManager(); + + /* @var DBAL\Migrations\Configuration\Configuration $migrationConfiguration */ + $this->configuration = $serviceManager->get('doctrine.migrations_configuration.orm_default'); + } + + return $this->configuration; + } +} From 78bec4017d279b51d03ea218a41d923642a35dda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Mo=CC=88ller?= Date: Sat, 26 Sep 2015 13:16:15 +0200 Subject: [PATCH 10/11] Fix: Move migrations into Application namespace --- config/autoload/global.php | 4 ++-- .../Doctrine/DBAL/Migration}/Version20150926125836.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename {data/migrations => module/Application/src/Application/Doctrine/DBAL/Migration}/Version20150926125836.php (98%) diff --git a/config/autoload/global.php b/config/autoload/global.php index 2c1ec246..8bc724c1 100644 --- a/config/autoload/global.php +++ b/config/autoload/global.php @@ -28,9 +28,9 @@ ], 'migrations_configuration' => [ 'orm_default' => [ - 'directory' => 'data/migrations', + 'directory' => 'module/Application/src/Application/Doctrine/DBAL/Migration', 'name' => 'ZFModules DBAL Migrations', - 'namespace' => 'ZfModulesMigrations', + 'namespace' => 'Application\Doctrine\DBAL\Migration', 'table' => 'doctrine_migration_versions', ], ], diff --git a/data/migrations/Version20150926125836.php b/module/Application/src/Application/Doctrine/DBAL/Migration/Version20150926125836.php similarity index 98% rename from data/migrations/Version20150926125836.php rename to module/Application/src/Application/Doctrine/DBAL/Migration/Version20150926125836.php index cb9aeadc..d9cdfff4 100644 --- a/data/migrations/Version20150926125836.php +++ b/module/Application/src/Application/Doctrine/DBAL/Migration/Version20150926125836.php @@ -1,6 +1,6 @@ Date: Sat, 26 Sep 2015 13:19:33 +0200 Subject: [PATCH 11/11] Enhancement: Update build target --- build.xml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/build.xml b/build.xml index 2c466b8b..34518724 100644 --- a/build.xml +++ b/build.xml @@ -22,7 +22,12 @@ - + + +