From 20bc31ad151690e560611a35ed9e45477316ed6a Mon Sep 17 00:00:00 2001 From: Mohamed Mahdy Date: Tue, 3 Jul 2018 16:06:47 +0200 Subject: [PATCH 01/18] init main structure --- composer.json | 3 +- config/modules.config.php | 1 + .../view/application/index/index.phtml | 2 +- module/Application/view/layout/layout.phtml | 2 + module/Catalog/config/module.config.php | 48 ++++++++ .../src/Controller/CategoryController.php | 24 ++++ .../src/Controller/ProductController.php | 25 +++++ module/Catalog/src/Module.php | 11 ++ .../test/Controller/IndexControllerTest.php | 48 ++++++++ module/Catalog/view/catalog/add.phtml | 3 + module/Catalog/view/catalog/index/index.phtml | 44 ++++++++ .../Catalog/view/catalog/product/index.phtml | 53 +++++++++ module/Catalog/view/error/404.phtml | 105 ++++++++++++++++++ module/Catalog/view/error/index.phtml | 63 +++++++++++ 14 files changed, 430 insertions(+), 2 deletions(-) create mode 100644 module/Catalog/config/module.config.php create mode 100644 module/Catalog/src/Controller/CategoryController.php create mode 100644 module/Catalog/src/Controller/ProductController.php create mode 100644 module/Catalog/src/Module.php create mode 100644 module/Catalog/test/Controller/IndexControllerTest.php create mode 100644 module/Catalog/view/catalog/add.phtml create mode 100644 module/Catalog/view/catalog/index/index.phtml create mode 100644 module/Catalog/view/catalog/product/index.phtml create mode 100644 module/Catalog/view/error/404.phtml create mode 100644 module/Catalog/view/error/index.phtml diff --git a/composer.json b/composer.json index a65fe86..99acdd5 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,8 @@ }, "autoload": { "psr-4": { - "Application\\": "module/Application/src/" + "Application\\": "module/Application/src/", + "Catalog\\": "module/Catalog/src/" } }, "autoload-dev": { diff --git a/config/modules.config.php b/config/modules.config.php index 81b5749..8df4a11 100644 --- a/config/modules.config.php +++ b/config/modules.config.php @@ -9,4 +9,5 @@ 'Zend\Router', 'Zend\Validator', 'Application', + 'Catalog', ]; diff --git a/module/Application/view/application/index/index.phtml b/module/Application/view/application/index/index.phtml index def2b5d..595f90b 100644 --- a/module/Application/view/application/index/index.phtml +++ b/module/Application/view/application/index/index.phtml @@ -1,3 +1,3 @@
-

Application Index

+

Catalog App

diff --git a/module/Application/view/layout/layout.phtml b/module/Application/view/layout/layout.phtml index 14dac28..486c748 100644 --- a/module/Application/view/layout/layout.phtml +++ b/module/Application/view/layout/layout.phtml @@ -40,6 +40,8 @@ diff --git a/module/Catalog/config/module.config.php b/module/Catalog/config/module.config.php new file mode 100644 index 0000000..0cd4711 --- /dev/null +++ b/module/Catalog/config/module.config.php @@ -0,0 +1,48 @@ + [ + 'routes' => [ + 'catalog' => [ + 'type' => Segment::class, + 'options' => [ + 'route' => '/catalog/products', + 'defaults' => [ + 'controller' => Controller\ProductController::class, + 'action' => 'index', + ], + ], + ], + + ], + ], + 'controllers' => [ + 'factories' => [ + Controller\ProductController::class => InvokableFactory::class, + ], + ], + 'view_manager' => [ + 'display_not_found_reason' => true, + 'display_exceptions' => true, + 'doctype' => 'HTML5', + 'not_found_template' => 'error/404', + 'exception_template' => 'error/index', + 'template_map' => [ + 'layout/layout' => __DIR__ . '/../view/layout/layout.phtml', + 'catalog/catalog/products/index' => __DIR__ . '/../view/catalog/product/index.phtml', + // 'catalog/catalog/add' => __DIR__ . '/../view/catalog/add.phtml', + // 'catalog/catalog/edit' => __DIR__ . '/../view/catalog/edit.phtml', + 'error/404' => __DIR__ . '/../view/error/404.phtml', + 'error/index' => __DIR__ . '/../view/error/index.phtml', + ], + 'template_path_stack' => [ + __DIR__ . '/../view', + ], + ], +]; diff --git a/module/Catalog/src/Controller/CategoryController.php b/module/Catalog/src/Controller/CategoryController.php new file mode 100644 index 0000000..376468b --- /dev/null +++ b/module/Catalog/src/Controller/CategoryController.php @@ -0,0 +1,24 @@ +setApplicationConfig(ArrayUtils::merge( + include __DIR__ . '/../../../../config/application.config.php', + $configOverrides + )); + + parent::setUp(); + } + + public function testIndexActionCanBeAccessed() + { + $this->dispatch('/', 'GET'); + $this->assertResponseStatusCode(200); + $this->assertModuleName('application'); + $this->assertControllerName(IndexController::class); // as specified in router's controller name alias + $this->assertControllerClass('IndexController'); + $this->assertMatchedRouteName('home'); + } + + public function testIndexActionViewModelTemplateRenderedWithinLayout() + { + $this->dispatch('/', 'GET'); + $this->assertQuery('.container .jumbotron'); + } + + public function testInvalidRouteDoesNotCrash() + { + $this->dispatch('/invalid/route', 'GET'); + $this->assertResponseStatusCode(404); + } +} diff --git a/module/Catalog/view/catalog/add.phtml b/module/Catalog/view/catalog/add.phtml new file mode 100644 index 0000000..70900f8 --- /dev/null +++ b/module/Catalog/view/catalog/add.phtml @@ -0,0 +1,3 @@ +
+

Add

+
diff --git a/module/Catalog/view/catalog/index/index.phtml b/module/Catalog/view/catalog/index/index.phtml new file mode 100644 index 0000000..0951905 --- /dev/null +++ b/module/Catalog/view/catalog/index/index.phtml @@ -0,0 +1,44 @@ +
+

Manage Categories

+
+ +
+ + Add new categories +

+ + + + + + + + + + + + + + + + + + + + + + + +
IDTitleAction
1News + View Products + Edit + Delete +
2Products + View Products + Edit + Delete +
3Blogs + View Products + Edit + Delete +
+
diff --git a/module/Catalog/view/catalog/product/index.phtml b/module/Catalog/view/catalog/product/index.phtml new file mode 100644 index 0000000..5f67457 --- /dev/null +++ b/module/Catalog/view/catalog/product/index.phtml @@ -0,0 +1,53 @@ +
+

Manage Products

+
+ +
+ + Add new Product +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IDProduct namedescriptioncreated datecategoryAction
1NewsNewsNews + View Products + Edit + Delete +
2ProductsProductsProducts + View Products + Edit + Delete +
3BlogsBlogsBlogs + View Products + Edit + Delete +
+
diff --git a/module/Catalog/view/error/404.phtml b/module/Catalog/view/error/404.phtml new file mode 100644 index 0000000..1b4ebca --- /dev/null +++ b/module/Catalog/view/error/404.phtml @@ -0,0 +1,105 @@ + +

A 404 error occurred

+

message ?>

+ +reason)) : + switch ($this->reason) { + case Application::ERROR_CONTROLLER_CANNOT_DISPATCH: + $reasonMessage = 'The requested controller was unable to dispatch the request.'; + break; + case Application::ERROR_MIDDLEWARE_CANNOT_DISPATCH: + $reasonMessage = 'The requested middleware was unable to dispatch the request.'; + break; + case Application::ERROR_CONTROLLER_NOT_FOUND: + $reasonMessage = 'The requested controller could not be mapped to an existing controller class.'; + break; + case Application::ERROR_CONTROLLER_INVALID: + $reasonMessage = 'The requested controller was not dispatchable.'; + break; + case Application::ERROR_ROUTER_NO_MATCH: + $reasonMessage = 'The requested URL could not be matched by routing.'; + break; + default: + $reasonMessage = 'We cannot determine at this time why a 404 was generated.'; + break; + } + ?> +

+ + +controller)) : ?> +
+
Controller:
+
+ escapeHtml($this->controller) ?> + controller_class) && $this->controller_class != $this->controller) { + printf('(resolves to %s)', $this->escapeHtml($this->controller_class)); + } + ?> +
+
+ + +display_exceptions)) : ?> + exception) + && ($this->exception instanceof \Exception || $this->exception instanceof \Error)) : ?> +
+ +

Additional information:

+

exception) ?>

+
+
File:
+
+
exception->getFile() ?>:exception->getLine() ?>
+
+
Message:
+
+
escapeHtml($this->exception->getMessage()) ?>
+
+
Stack trace:
+
+
escapeHtml($this->exception->getTraceAsString()) ?>
+
+
+ + exception->getPrevious()) : ?> +
+ +

Previous exceptions:

+ + + +

No Exception available

+ + diff --git a/module/Catalog/view/error/index.phtml b/module/Catalog/view/error/index.phtml new file mode 100644 index 0000000..1b28a21 --- /dev/null +++ b/module/Catalog/view/error/index.phtml @@ -0,0 +1,63 @@ +

An error occurred

+

message ?>

+ +display_exceptions)) : ?> + exception) + && ($this->exception instanceof \Exception || $this->exception instanceof \Error)) : ?> +
+ +

Additional information:

+

exception) ?>

+
+
File:
+
+
exception->getFile() ?>:exception->getLine() ?>
+
+
Message:
+
+
escapeHtml($this->exception->getMessage()) ?>
+
+
Stack trace:
+
+
escapeHtml($this->exception->getTraceAsString()) ?>
+
+
+ + exception->getPrevious()) : ?> +
+ +

Previous exceptions:

+ + + +

No Exception available

+ + From 2c7524652ba7249cfef14bca3e4edf73f84e28ad Mon Sep 17 00:00:00 2001 From: Mohamed Mahdy Date: Tue, 3 Jul 2018 18:05:19 +0200 Subject: [PATCH 02/18] Project mapping & init layout --- module/Application/view/layout/layout.phtml | 4 +- module/Catalog/config/module.config.php | 17 ++++-- .../src/Controller/CategoryController.php | 3 +- .../Catalog/view/catalog/category/index.phtml | 44 +++++++++++++++ module/Catalog/view/layout/layout.phtml | 54 +++++++++++++++++++ themes/default/layout/layout.phtml | 54 +++++++++++++++++++ 6 files changed, 170 insertions(+), 6 deletions(-) create mode 100644 module/Catalog/view/catalog/category/index.phtml create mode 100644 module/Catalog/view/layout/layout.phtml create mode 100644 themes/default/layout/layout.phtml diff --git a/module/Application/view/layout/layout.phtml b/module/Application/view/layout/layout.phtml index 486c748..66a3ae1 100644 --- a/module/Application/view/layout/layout.phtml +++ b/module/Application/view/layout/layout.phtml @@ -40,8 +40,8 @@ diff --git a/module/Catalog/config/module.config.php b/module/Catalog/config/module.config.php index 0cd4711..6e8dd67 100644 --- a/module/Catalog/config/module.config.php +++ b/module/Catalog/config/module.config.php @@ -9,7 +9,7 @@ return [ 'router' => [ 'routes' => [ - 'catalog' => [ + 'products' => [ 'type' => Segment::class, 'options' => [ 'route' => '/catalog/products', @@ -19,12 +19,23 @@ ], ], ], + 'categories' => [ + 'type' => Segment::class, + 'options' => [ + 'route' => '/catalog/categories', + 'defaults' => [ + 'controller' => Controller\CategoryController::class, + 'action' => 'index', + ], + ], + ], ], ], 'controllers' => [ 'factories' => [ Controller\ProductController::class => InvokableFactory::class, + Controller\CategoryController::class => InvokableFactory::class, ], ], 'view_manager' => [ @@ -34,8 +45,8 @@ 'not_found_template' => 'error/404', 'exception_template' => 'error/index', 'template_map' => [ - 'layout/layout' => __DIR__ . '/../view/layout/layout.phtml', - 'catalog/catalog/products/index' => __DIR__ . '/../view/catalog/product/index.phtml', + 'layout/layout' => __DIR__ . '/../../../themes/default/layout/layout.phtml', + 'products/idex' => __DIR__ . '/../view/catalog/product/index.phtml', // 'catalog/catalog/add' => __DIR__ . '/../view/catalog/add.phtml', // 'catalog/catalog/edit' => __DIR__ . '/../view/catalog/edit.phtml', 'error/404' => __DIR__ . '/../view/error/404.phtml', diff --git a/module/Catalog/src/Controller/CategoryController.php b/module/Catalog/src/Controller/CategoryController.php index 376468b..9da66af 100644 --- a/module/Catalog/src/Controller/CategoryController.php +++ b/module/Catalog/src/Controller/CategoryController.php @@ -1,6 +1,6 @@ +

Manage Categories

+ + +
+ + Add new Category +

+ + + + + + + + + + + + + + + + + + + + + + + +
IDCategory nameAction
1Cat name + View Products + Edit + Delete +
2Cat name + View Products + Edit + Delete +
3category name + View Products + Edit + Delete +
+
diff --git a/module/Catalog/view/layout/layout.phtml b/module/Catalog/view/layout/layout.phtml new file mode 100644 index 0000000..03d7e22 --- /dev/null +++ b/module/Catalog/view/layout/layout.phtml @@ -0,0 +1,54 @@ +doctype() ?> + + + + headTitle('Application')->setSeparator(' - ')->setAutoEscape(false) ?> + + headMeta() + ->appendName('viewport', 'width=device-width, initial-scale=1.0') + ->appendHttpEquiv('X-UA-Compatible', 'IE=edge') + ?> + + + headLink(['rel' => 'shortcut icon', 'type' => 'image/vnd.microsoft.icon', 'href' => $this->basePath() . '/img/favicon.ico']) + ->prependStylesheet($this->basePath('css/style.css')) + ->prependStylesheet($this->basePath('css/bootstrap-theme.min.css')) + ->prependStylesheet($this->basePath('css/bootstrap.min.css')) + ?> + + + headScript() + ->prependFile($this->basePath('js/bootstrap.min.js')) + ->prependFile($this->basePath('js/jquery-3.1.0.min.js')) + ?> + + + +
+ content ?> +
+ inlineScript() ?> + + diff --git a/themes/default/layout/layout.phtml b/themes/default/layout/layout.phtml new file mode 100644 index 0000000..03d7e22 --- /dev/null +++ b/themes/default/layout/layout.phtml @@ -0,0 +1,54 @@ +doctype() ?> + + + + headTitle('Application')->setSeparator(' - ')->setAutoEscape(false) ?> + + headMeta() + ->appendName('viewport', 'width=device-width, initial-scale=1.0') + ->appendHttpEquiv('X-UA-Compatible', 'IE=edge') + ?> + + + headLink(['rel' => 'shortcut icon', 'type' => 'image/vnd.microsoft.icon', 'href' => $this->basePath() . '/img/favicon.ico']) + ->prependStylesheet($this->basePath('css/style.css')) + ->prependStylesheet($this->basePath('css/bootstrap-theme.min.css')) + ->prependStylesheet($this->basePath('css/bootstrap.min.css')) + ?> + + + headScript() + ->prependFile($this->basePath('js/bootstrap.min.js')) + ->prependFile($this->basePath('js/jquery-3.1.0.min.js')) + ?> + + + +
+ content ?> +
+ inlineScript() ?> + + From c8e888b1011462a8bdd865ccb6051865f727266c Mon Sep 17 00:00:00 2001 From: Mohamed Mahdy Date: Tue, 3 Jul 2018 19:46:53 +0200 Subject: [PATCH 03/18] Split catalog module in 2 modules ( category - product ) --- composer.json | 3 +- config/modules.config.php | 3 +- module/Application/config/module.config.php | 2 +- module/Application/view/layout/layout.phtml | 54 --------- module/Catalog/view/catalog/add.phtml | 3 - module/Catalog/view/catalog/index/index.phtml | 44 -------- module/Catalog/view/layout/layout.phtml | 54 --------- module/Category/config/module.config.php | 47 ++++++++ .../src/Controller/CategoryController.php | 4 +- module/Category/src/Module.php | 11 ++ .../test/Controller/IndexControllerTest.php | 0 .../view}/category/index.phtml | 0 .../view/error/404.phtml | 0 .../view/error/index.phtml | 0 .../config/module.config.php | 22 +--- .../src/Controller/ProductController.php | 4 +- module/{Catalog => Product}/src/Module.php | 2 +- .../test/Controller/IndexControllerTest.php | 48 ++++++++ module/Product/view/error/404.phtml | 105 ++++++++++++++++++ module/Product/view/error/index.phtml | 63 +++++++++++ .../view}/product/index.phtml | 3 - themes/default/layout/layout.phtml | 4 +- 22 files changed, 291 insertions(+), 185 deletions(-) delete mode 100644 module/Application/view/layout/layout.phtml delete mode 100644 module/Catalog/view/catalog/add.phtml delete mode 100644 module/Catalog/view/catalog/index/index.phtml delete mode 100644 module/Catalog/view/layout/layout.phtml create mode 100644 module/Category/config/module.config.php rename module/{Catalog => Category}/src/Controller/CategoryController.php (87%) create mode 100644 module/Category/src/Module.php rename module/{Catalog => Category}/test/Controller/IndexControllerTest.php (100%) rename module/{Catalog/view/catalog => Category/view}/category/index.phtml (100%) rename module/{Catalog => Category}/view/error/404.phtml (100%) rename module/{Catalog => Category}/view/error/index.phtml (100%) rename module/{Catalog => Product}/config/module.config.php (69%) rename module/{Catalog => Product}/src/Controller/ProductController.php (87%) rename module/{Catalog => Product}/src/Module.php (87%) create mode 100644 module/Product/test/Controller/IndexControllerTest.php create mode 100644 module/Product/view/error/404.phtml create mode 100644 module/Product/view/error/index.phtml rename module/{Catalog/view/catalog => Product/view}/product/index.phtml (82%) diff --git a/composer.json b/composer.json index 99acdd5..e10a7a0 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,8 @@ "autoload": { "psr-4": { "Application\\": "module/Application/src/", - "Catalog\\": "module/Catalog/src/" + "Product\\": "module/Product/src/", + "Category\\": "module/Category/src/" } }, "autoload-dev": { diff --git a/config/modules.config.php b/config/modules.config.php index 8df4a11..1913926 100644 --- a/config/modules.config.php +++ b/config/modules.config.php @@ -9,5 +9,6 @@ 'Zend\Router', 'Zend\Validator', 'Application', - 'Catalog', + 'Product', + 'Category', ]; diff --git a/module/Application/config/module.config.php b/module/Application/config/module.config.php index 7bb6a67..9babc85 100644 --- a/module/Application/config/module.config.php +++ b/module/Application/config/module.config.php @@ -43,7 +43,7 @@ 'not_found_template' => 'error/404', 'exception_template' => 'error/index', 'template_map' => [ - 'layout/layout' => __DIR__ . '/../view/layout/layout.phtml', + 'layout/layout' => __DIR__ . '/../../../view/layout/layout.phtml', 'application/index/index' => __DIR__ . '/../view/application/index/index.phtml', 'error/404' => __DIR__ . '/../view/error/404.phtml', 'error/index' => __DIR__ . '/../view/error/index.phtml', diff --git a/module/Application/view/layout/layout.phtml b/module/Application/view/layout/layout.phtml deleted file mode 100644 index 66a3ae1..0000000 --- a/module/Application/view/layout/layout.phtml +++ /dev/null @@ -1,54 +0,0 @@ -doctype() ?> - - - - headTitle('Application')->setSeparator(' - ')->setAutoEscape(false) ?> - - headMeta() - ->appendName('viewport', 'width=device-width, initial-scale=1.0') - ->appendHttpEquiv('X-UA-Compatible', 'IE=edge') - ?> - - - headLink(['rel' => 'shortcut icon', 'type' => 'image/vnd.microsoft.icon', 'href' => $this->basePath() . '/img/favicon.ico']) - ->prependStylesheet($this->basePath('css/style.css')) - ->prependStylesheet($this->basePath('css/bootstrap-theme.min.css')) - ->prependStylesheet($this->basePath('css/bootstrap.min.css')) - ?> - - - headScript() - ->prependFile($this->basePath('js/bootstrap.min.js')) - ->prependFile($this->basePath('js/jquery-3.1.0.min.js')) - ?> - - - -
- content ?> -
- inlineScript() ?> - - diff --git a/module/Catalog/view/catalog/add.phtml b/module/Catalog/view/catalog/add.phtml deleted file mode 100644 index 70900f8..0000000 --- a/module/Catalog/view/catalog/add.phtml +++ /dev/null @@ -1,3 +0,0 @@ -
-

Add

-
diff --git a/module/Catalog/view/catalog/index/index.phtml b/module/Catalog/view/catalog/index/index.phtml deleted file mode 100644 index 0951905..0000000 --- a/module/Catalog/view/catalog/index/index.phtml +++ /dev/null @@ -1,44 +0,0 @@ -
-

Manage Categories

-
- -
- + Add new categories -

- - - - - - - - - - - - - - - - - - - - - - - -
IDTitleAction
1News - View Products - Edit - Delete -
2Products - View Products - Edit - Delete -
3Blogs - View Products - Edit - Delete -
-
diff --git a/module/Catalog/view/layout/layout.phtml b/module/Catalog/view/layout/layout.phtml deleted file mode 100644 index 03d7e22..0000000 --- a/module/Catalog/view/layout/layout.phtml +++ /dev/null @@ -1,54 +0,0 @@ -doctype() ?> - - - - headTitle('Application')->setSeparator(' - ')->setAutoEscape(false) ?> - - headMeta() - ->appendName('viewport', 'width=device-width, initial-scale=1.0') - ->appendHttpEquiv('X-UA-Compatible', 'IE=edge') - ?> - - - headLink(['rel' => 'shortcut icon', 'type' => 'image/vnd.microsoft.icon', 'href' => $this->basePath() . '/img/favicon.ico']) - ->prependStylesheet($this->basePath('css/style.css')) - ->prependStylesheet($this->basePath('css/bootstrap-theme.min.css')) - ->prependStylesheet($this->basePath('css/bootstrap.min.css')) - ?> - - - headScript() - ->prependFile($this->basePath('js/bootstrap.min.js')) - ->prependFile($this->basePath('js/jquery-3.1.0.min.js')) - ?> - - - -
- content ?> -
- inlineScript() ?> - - diff --git a/module/Category/config/module.config.php b/module/Category/config/module.config.php new file mode 100644 index 0000000..67ba112 --- /dev/null +++ b/module/Category/config/module.config.php @@ -0,0 +1,47 @@ + [ + 'routes' => [ + 'category-list' => [ + 'type' => Segment::class, + 'options' => [ + 'route' => '/category/list', + 'defaults' => [ + 'controller' => Controller\CategoryController::class, + 'action' => 'index', + ], + ], + ], + ], + ], + 'controllers' => [ + 'factories' => [ + Controller\CategoryController::class => InvokableFactory::class, + ], + ], + 'view_manager' => [ + 'display_not_found_reason' => true, + 'display_exceptions' => true, + 'doctype' => 'HTML5', + 'not_found_template' => 'error/404', + 'exception_template' => 'error/index', + 'template_map' => [ + 'layout/layout' => __DIR__ . '/../../../themes/default/layout/layout.phtml', + 'category/category/index' => __DIR__ . '/../view/category/index.phtml', + // 'catalog/catalog/add' => __DIR__ . '/../view/catalog/add.phtml', + // 'catalog/catalog/edit' => __DIR__ . '/../view/catalog/edit.phtml', + 'error/404' => __DIR__ . '/../view/error/404.phtml', + 'error/index' => __DIR__ . '/../view/error/index.phtml', + ], + 'template_path_stack' => [ + __DIR__ . '/../view', + ], + ], +]; diff --git a/module/Catalog/src/Controller/CategoryController.php b/module/Category/src/Controller/CategoryController.php similarity index 87% rename from module/Catalog/src/Controller/CategoryController.php rename to module/Category/src/Controller/CategoryController.php index 9da66af..8a0e8e9 100644 --- a/module/Catalog/src/Controller/CategoryController.php +++ b/module/Category/src/Controller/CategoryController.php @@ -1,6 +1,6 @@ [ 'routes' => [ - 'products' => [ + 'product' => [ 'type' => Segment::class, 'options' => [ - 'route' => '/catalog/products', + 'route' => '/product/list', 'defaults' => [ 'controller' => Controller\ProductController::class, 'action' => 'index', ], ], - ], - 'categories' => [ - 'type' => Segment::class, - 'options' => [ - 'route' => '/catalog/categories', - 'defaults' => [ - 'controller' => Controller\CategoryController::class, - 'action' => 'index', - ], - ], - ], - + ] ], ], 'controllers' => [ 'factories' => [ Controller\ProductController::class => InvokableFactory::class, - Controller\CategoryController::class => InvokableFactory::class, ], ], 'view_manager' => [ @@ -46,7 +34,7 @@ 'exception_template' => 'error/index', 'template_map' => [ 'layout/layout' => __DIR__ . '/../../../themes/default/layout/layout.phtml', - 'products/idex' => __DIR__ . '/../view/catalog/product/index.phtml', + 'product/product/index' => __DIR__ . '/../view/product/index.phtml', // 'catalog/catalog/add' => __DIR__ . '/../view/catalog/add.phtml', // 'catalog/catalog/edit' => __DIR__ . '/../view/catalog/edit.phtml', 'error/404' => __DIR__ . '/../view/error/404.phtml', diff --git a/module/Catalog/src/Controller/ProductController.php b/module/Product/src/Controller/ProductController.php similarity index 87% rename from module/Catalog/src/Controller/ProductController.php rename to module/Product/src/Controller/ProductController.php index 1bd41ba..842b459 100644 --- a/module/Catalog/src/Controller/ProductController.php +++ b/module/Product/src/Controller/ProductController.php @@ -1,6 +1,6 @@ setApplicationConfig(ArrayUtils::merge( + include __DIR__ . '/../../../../config/application.config.php', + $configOverrides + )); + + parent::setUp(); + } + + public function testIndexActionCanBeAccessed() + { + $this->dispatch('/', 'GET'); + $this->assertResponseStatusCode(200); + $this->assertModuleName('application'); + $this->assertControllerName(IndexController::class); // as specified in router's controller name alias + $this->assertControllerClass('IndexController'); + $this->assertMatchedRouteName('home'); + } + + public function testIndexActionViewModelTemplateRenderedWithinLayout() + { + $this->dispatch('/', 'GET'); + $this->assertQuery('.container .jumbotron'); + } + + public function testInvalidRouteDoesNotCrash() + { + $this->dispatch('/invalid/route', 'GET'); + $this->assertResponseStatusCode(404); + } +} diff --git a/module/Product/view/error/404.phtml b/module/Product/view/error/404.phtml new file mode 100644 index 0000000..1b4ebca --- /dev/null +++ b/module/Product/view/error/404.phtml @@ -0,0 +1,105 @@ + +

A 404 error occurred

+

message ?>

+ +reason)) : + switch ($this->reason) { + case Application::ERROR_CONTROLLER_CANNOT_DISPATCH: + $reasonMessage = 'The requested controller was unable to dispatch the request.'; + break; + case Application::ERROR_MIDDLEWARE_CANNOT_DISPATCH: + $reasonMessage = 'The requested middleware was unable to dispatch the request.'; + break; + case Application::ERROR_CONTROLLER_NOT_FOUND: + $reasonMessage = 'The requested controller could not be mapped to an existing controller class.'; + break; + case Application::ERROR_CONTROLLER_INVALID: + $reasonMessage = 'The requested controller was not dispatchable.'; + break; + case Application::ERROR_ROUTER_NO_MATCH: + $reasonMessage = 'The requested URL could not be matched by routing.'; + break; + default: + $reasonMessage = 'We cannot determine at this time why a 404 was generated.'; + break; + } + ?> +

+ + +controller)) : ?> +
+
Controller:
+
+ escapeHtml($this->controller) ?> + controller_class) && $this->controller_class != $this->controller) { + printf('(resolves to %s)', $this->escapeHtml($this->controller_class)); + } + ?> +
+
+ + +display_exceptions)) : ?> + exception) + && ($this->exception instanceof \Exception || $this->exception instanceof \Error)) : ?> +
+ +

Additional information:

+

exception) ?>

+
+
File:
+
+
exception->getFile() ?>:exception->getLine() ?>
+
+
Message:
+
+
escapeHtml($this->exception->getMessage()) ?>
+
+
Stack trace:
+
+
escapeHtml($this->exception->getTraceAsString()) ?>
+
+
+ + exception->getPrevious()) : ?> +
+ +

Previous exceptions:

+
    + + +
  • +

    +
    +
    File:
    +
    +
    getFile() ?>:getLine() ?>
    +
    +
    Message:
    +
    +
    escapeHtml($ex->getMessage()) ?>
    +
    +
    Stack trace:
    +
    +
    escapeHtml($ex->getTraceAsString()) ?>
    +
    +
    +
  • + getPrevious(); + if (++$icount >= 50) { + echo '
  • There may be more exceptions, but we do not have enough memory to process it.
  • '; + break; + } + ?> + +
+ + +

No Exception available

+ + diff --git a/module/Product/view/error/index.phtml b/module/Product/view/error/index.phtml new file mode 100644 index 0000000..1b28a21 --- /dev/null +++ b/module/Product/view/error/index.phtml @@ -0,0 +1,63 @@ +

An error occurred

+

message ?>

+ +display_exceptions)) : ?> + exception) + && ($this->exception instanceof \Exception || $this->exception instanceof \Error)) : ?> +
+ +

Additional information:

+

exception) ?>

+
+
File:
+
+
exception->getFile() ?>:exception->getLine() ?>
+
+
Message:
+
+
escapeHtml($this->exception->getMessage()) ?>
+
+
Stack trace:
+
+
escapeHtml($this->exception->getTraceAsString()) ?>
+
+
+ + exception->getPrevious()) : ?> +
+ +

Previous exceptions:

+
    + + +
  • +

    +
    +
    File:
    +
    +
    getFile() ?>:getLine() ?>
    +
    +
    Message:
    +
    +
    escapeHtml($ex->getMessage()) ?>
    +
    +
    Stack trace:
    +
    +
    escapeHtml($ex->getTraceAsString()) ?>
    +
    +
    +
  • + getPrevious(); + if (++$icount >= 50) { + echo '
  • There may be more exceptions, but we do not have enough memory to process it.
  • '; + break; + } + ?> + +
+ + +

No Exception available

+ + diff --git a/module/Catalog/view/catalog/product/index.phtml b/module/Product/view/product/index.phtml similarity index 82% rename from module/Catalog/view/catalog/product/index.phtml rename to module/Product/view/product/index.phtml index 5f67457..771d581 100644 --- a/module/Catalog/view/catalog/product/index.phtml +++ b/module/Product/view/product/index.phtml @@ -22,7 +22,6 @@ News News - View Products Edit Delete @@ -33,7 +32,6 @@ Products Products - View Products Edit Delete @@ -44,7 +42,6 @@ Blogs Blogs - View Products Edit Delete diff --git a/themes/default/layout/layout.phtml b/themes/default/layout/layout.phtml index 03d7e22..88cfd73 100644 --- a/themes/default/layout/layout.phtml +++ b/themes/default/layout/layout.phtml @@ -40,8 +40,8 @@ From 29afbbecb6054d51314737fc12c40ce026a6162d Mon Sep 17 00:00:00 2001 From: Mohamed Mahdy Date: Wed, 4 Jul 2018 12:08:59 +0200 Subject: [PATCH 04/18] integrate doctrine modules with zend framwork 3 --- Dockerfile | 2 + composer.json | 3 +- composer.lock | 1874 ++++++++++++++++++++++++--- config/autoload/doctrine.docker.php | 18 + config/autoload/doctrine.global.php | 27 + config/modules.config.php | 2 + 6 files changed, 1747 insertions(+), 179 deletions(-) create mode 100644 config/autoload/doctrine.docker.php create mode 100644 config/autoload/doctrine.global.php diff --git a/Dockerfile b/Dockerfile index fae3669..ab3f9c3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,8 @@ FROM php:7.0-apache RUN apt-get update \ && apt-get install -y git zlib1g-dev \ && docker-php-ext-install zip \ + && docker-php-ext-install pdo_mysql \ + && a2enmod rewrite \ && sed -i 's!/var/www/html!/var/www/public!g' /etc/apache2/sites-available/000-default.conf \ && mv /var/www/html /var/www/public \ diff --git a/composer.json b/composer.json index e10a7a0..dd915ae 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,8 @@ "require": { "php": "^7.0", "zendframework/zend-component-installer": "^1.0", - "zendframework/zend-mvc": "^3.0.1" + "zendframework/zend-mvc": "^3.0.1", + "doctrine/doctrine-orm-module": "^1.1" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index dd1a3ce..78b4800 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c3a709540b2acefe197d17a6dd2fcb6d", + "content-hash": "9afb8e7da01e97a122ac373498bdef79", "packages": [ { "name": "container-interop/container-interop", @@ -37,54 +37,1304 @@ "homepage": "https://github.com/container-interop/container-interop", "time": "2017-02-14T19:40:03+00:00" }, + { + "name": "doctrine/annotations", + "version": "v1.4.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/annotations.git", + "reference": "54cacc9b81758b14e3ce750f205a393d52339e97" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/54cacc9b81758b14e3ce750f205a393d52339e97", + "reference": "54cacc9b81758b14e3ce750f205a393d52339e97", + "shasum": "" + }, + "require": { + "doctrine/lexer": "1.*", + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "doctrine/cache": "1.*", + "phpunit/phpunit": "^5.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" + } + }, + "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": "2017-02-24T16:22:25+00:00" + }, + { + "name": "doctrine/cache", + "version": "v1.6.2", + "source": { + "type": "git", + "url": "https://github.com/doctrine/cache.git", + "reference": "eb152c5100571c7a45470ff2a35095ab3f3b900b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/cache/zipball/eb152c5100571c7a45470ff2a35095ab3f3b900b", + "reference": "eb152c5100571c7a45470ff2a35095ab3f3b900b", + "shasum": "" + }, + "require": { + "php": "~5.5|~7.0" + }, + "conflict": { + "doctrine/common": ">2.2,<2.4" + }, + "require-dev": { + "phpunit/phpunit": "~4.8|~5.0", + "predis/predis": "~1.0", + "satooshi/php-coveralls": "~0.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" + } + }, + "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": "2017-07-22T12:49:21+00:00" + }, + { + "name": "doctrine/collections", + "version": "v1.4.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/collections.git", + "reference": "1a4fb7e902202c33cce8c55989b945612943c2ba" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/collections/zipball/1a4fb7e902202c33cce8c55989b945612943c2ba", + "reference": "1a4fb7e902202c33cce8c55989b945612943c2ba", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "doctrine/coding-standard": "~0.1@dev", + "phpunit/phpunit": "^5.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.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": "2017-01-03T10:49:41+00:00" + }, + { + "name": "doctrine/common", + "version": "v2.7.3", + "source": { + "type": "git", + "url": "https://github.com/doctrine/common.git", + "reference": "4acb8f89626baafede6ee5475bc5844096eba8a9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/common/zipball/4acb8f89626baafede6ee5475bc5844096eba8a9", + "reference": "4acb8f89626baafede6ee5475bc5844096eba8a9", + "shasum": "" + }, + "require": { + "doctrine/annotations": "1.*", + "doctrine/cache": "1.*", + "doctrine/collections": "1.*", + "doctrine/inflector": "1.*", + "doctrine/lexer": "1.*", + "php": "~5.6|~7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.4.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\": "lib/Doctrine/Common" + } + }, + "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": "2017-07-22T08:35:12+00:00" + }, + { + "name": "doctrine/dbal", + "version": "v2.5.13", + "source": { + "type": "git", + "url": "https://github.com/doctrine/dbal.git", + "reference": "729340d8d1eec8f01bff708e12e449a3415af873" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/729340d8d1eec8f01bff708e12e449a3415af873", + "reference": "729340d8d1eec8f01bff708e12e449a3415af873", + "shasum": "" + }, + "require": { + "doctrine/common": ">=2.4,<2.8-dev", + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "4.*", + "symfony/console": "2.*||^3.0" + }, + "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": "2017-07-22T20:44:48+00:00" + }, + { + "name": "doctrine/doctrine-module", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/DoctrineModule.git", + "reference": "9407d04d0b08e7071dab05c9d068cefda9dc5a6f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/DoctrineModule/zipball/9407d04d0b08e7071dab05c9d068cefda9dc5a6f", + "reference": "9407d04d0b08e7071dab05c9d068cefda9dc5a6f", + "shasum": "" + }, + "require": { + "doctrine/cache": "^1.6", + "doctrine/common": "^2.6.1", + "php": "^5.6 || ^7.0", + "symfony/console": "^2.3 || ^3.0", + "zendframework/zend-authentication": "^2.5.3", + "zendframework/zend-cache": "^2.7.1", + "zendframework/zend-form": "^2.9", + "zendframework/zend-hydrator": "^1.1 || ^2.2.1", + "zendframework/zend-mvc": "^2.7.10 || ^3.0.1", + "zendframework/zend-paginator": "^2.7", + "zendframework/zend-servicemanager": "^2.7.6 || ^3.1", + "zendframework/zend-stdlib": "^2.7.7 || ^3.0.1", + "zendframework/zend-validator": "^2.8.1" + }, + "require-dev": { + "phpunit/phpunit": "^4.8", + "squizlabs/php_codesniffer": "^2.6.2", + "zendframework/zend-i18n": "^2.7.3", + "zendframework/zend-log": "^2.9", + "zendframework/zend-modulemanager": "^2.7.2", + "zendframework/zend-serializer": "^2.8", + "zendframework/zend-session": "^2.7.3", + "zendframework/zend-test": "^2.6.1 || ^3.0.1", + "zendframework/zend-version": "^2.5.1" + }, + "suggest": { + "doctrine/data-fixtures": "Data Fixtures if you want to generate test data or bootstrap data for your deployments", + "zendframework/zend-mvc-console": "^1.1.10 if you are using ZF3" + }, + "bin": [ + "bin/doctrine-module" + ], + "type": "library", + "extra": { + "zf": { + "module": "DoctrineModule" + } + }, + "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 Module that provides Doctrine basic functionality required for ORM and ODM modules", + "homepage": "http://www.doctrine-project.org/", + "keywords": [ + "doctrine", + "module", + "zf" + ], + "time": "2016-10-03T19:40:55+00:00" + }, + { + "name": "doctrine/doctrine-orm-module", + "version": "1.1.5", + "source": { + "type": "git", + "url": "https://github.com/doctrine/DoctrineORMModule.git", + "reference": "8cb46190022ac71ef644416bd422ce2fb54d4823" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/DoctrineORMModule/zipball/8cb46190022ac71ef644416bd422ce2fb54d4823", + "reference": "8cb46190022ac71ef644416bd422ce2fb54d4823", + "shasum": "" + }, + "require": { + "doctrine/dbal": ">=2.4,<2.7", + "doctrine/doctrine-module": "^1.2", + "doctrine/orm": ">=2.5,<2.7", + "php": "^5.6 || ^7.0", + "symfony/console": "^2.3 || ^3.0", + "zendframework/zend-hydrator": "^1.1 || ^2.2.1", + "zendframework/zend-mvc": "^2.7.10 || ^3.0.1", + "zendframework/zend-servicemanager": "^2.7.6 || ^3.1", + "zendframework/zend-stdlib": "^2.7.7 || ^3.0.1" + }, + "require-dev": { + "doctrine/data-fixtures": "^1.2.1", + "doctrine/migrations": "^1.4.1", + "phpunit/phpunit": "^5.7.17 || ^6.2.1", + "squizlabs/php_codesniffer": "^2.7", + "zendframework/zend-console": "^2.6", + "zendframework/zend-developer-tools": "^1.1", + "zendframework/zend-i18n": "^2.7.3", + "zendframework/zend-log": "^2.9", + "zendframework/zend-modulemanager": "^2.7.2", + "zendframework/zend-serializer": "^2.8" + }, + "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", + "extra": { + "zf": { + "module": "DoctrineORMModule" + } + }, + "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 Module that provides Doctrine ORM functionality", + "homepage": "http://www.doctrine-project.org/", + "keywords": [ + "doctrine", + "module", + "orm", + "zf" + ], + "time": "2017-09-20T01:06:34+00:00" + }, + { + "name": "doctrine/inflector", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/inflector.git", + "reference": "e11d84c6e018beedd929cff5220969a3c6d1d462" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/e11d84c6e018beedd929cff5220969a3c6d1d462", + "reference": "e11d84c6e018beedd929cff5220969a3c6d1d462", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector" + } + }, + "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": "2017-07-22T12:18:28+00:00" + }, + { + "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-14T21:17:01+00:00" + }, + { + "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-09T13:34:57+00:00" + }, + { + "name": "doctrine/orm", + "version": "v2.5.14", + "source": { + "type": "git", + "url": "https://github.com/doctrine/doctrine2.git", + "reference": "810a7baf81462a5ddf10e8baa8cb94b6eec02754" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/doctrine2/zipball/810a7baf81462a5ddf10e8baa8cb94b6eec02754", + "reference": "810a7baf81462a5ddf10e8baa8cb94b6eec02754", + "shasum": "" + }, + "require": { + "doctrine/cache": "~1.4", + "doctrine/collections": "~1.2", + "doctrine/common": ">=2.5-dev,<2.9-dev", + "doctrine/dbal": ">=2.5-dev,<2.7-dev", + "doctrine/instantiator": "^1.0.1", + "ext-pdo": "*", + "php": ">=5.4", + "symfony/console": "~2.5|~3.0|~4.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0", + "symfony/yaml": "~2.3|~3.0|~4.0" + }, + "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": "2017-12-17T02:57:51+00:00" + }, + { + "name": "psr/cache", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "time": "2016-08-06T20:24:11+00:00" + }, { "name": "psr/container", "version": "1.0.0", "source": { "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-02-14T16:28:37+00:00" + }, + { + "name": "psr/log", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-10-10T12:19:37+00:00" + }, + { + "name": "psr/simple-cache", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/simple-cache.git", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\SimpleCache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interfaces for simple caching", + "keywords": [ + "cache", + "caching", + "psr", + "psr-16", + "simple-cache" + ], + "time": "2017-10-23T01:57:42+00:00" + }, + { + "name": "symfony/console", + "version": "v3.4.12", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "1b97071a26d028c9bd4588264e101e14f6e7cd00" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/1b97071a26d028c9bd4588264e101e14f6e7cd00", + "reference": "1b97071a26d028c9bd4588264e101e14f6e7cd00", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/debug": "~2.8|~3.0|~4.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/dependency-injection": "<3.4", + "symfony/process": "<3.3" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~3.3|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/event-dispatcher": "~2.8|~3.0|~4.0", + "symfony/lock": "~3.4|~4.0", + "symfony/process": "~3.3|~4.0" + }, + "suggest": { + "psr/log-implementation": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "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": "2018-05-23T05:02:55+00:00" + }, + { + "name": "symfony/debug", + "version": "v3.4.12", + "source": { + "type": "git", + "url": "https://github.com/symfony/debug.git", + "reference": "47e6788c5b151cf0cfdf3329116bf33800632d75" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/debug/zipball/47e6788c5b151cf0cfdf3329116bf33800632d75", + "reference": "47e6788c5b151cf0cfdf3329116bf33800632d75", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "psr/log": "~1.0" + }, + "conflict": { + "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + }, + "require-dev": { + "symfony/http-kernel": "~2.8|~3.0|~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "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 Debug Component", + "homepage": "https://symfony.com", + "time": "2018-06-25T11:10:40+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.8.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "3296adf6a6454a050679cde90f95350ad604b171" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/3296adf6a6454a050679cde90f95350ad604b171", + "reference": "3296adf6a6454a050679cde90f95350ad604b171", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2018-04-26T10:06:28+00:00" + }, + { + "name": "zendframework/zend-authentication", + "version": "2.6.0", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-authentication.git", + "reference": "ebc9464c11a5203e5256439f1079a7d6efe89eec" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-authentication/zipball/ebc9464c11a5203e5256439f1079a7d6efe89eec", + "reference": "ebc9464c11a5203e5256439f1079a7d6efe89eec", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0", + "zendframework/zend-stdlib": "^2.7.7 || ^3.1" + }, + "require-dev": { + "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.2", + "zendframework/zend-coding-standard": "~1.0.0", + "zendframework/zend-crypt": "^2.6 || ^3.2.1", + "zendframework/zend-db": "^2.8.2", + "zendframework/zend-http": "^2.7", + "zendframework/zend-ldap": "^2.8", + "zendframework/zend-session": "^2.8", + "zendframework/zend-uri": "^2.5.2", + "zendframework/zend-validator": "^2.10.1" + }, + "suggest": { + "zendframework/zend-crypt": "Zend\\Crypt component", + "zendframework/zend-db": "Zend\\Db component", + "zendframework/zend-http": "Zend\\Http component", + "zendframework/zend-ldap": "Zend\\Ldap component", + "zendframework/zend-session": "Zend\\Session component", + "zendframework/zend-uri": "Zend\\Uri component", + "zendframework/zend-validator": "Zend\\Validator component" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6.x-dev", + "dev-develop": "2.7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\Authentication\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "provides an API for authentication and includes concrete authentication adapters for common use case scenarios", + "keywords": [ + "Authentication", + "ZendFramework", + "zf" + ], + "time": "2018-04-12T21:09:22+00:00" + }, + { + "name": "zendframework/zend-cache", + "version": "2.8.2", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-cache.git", + "reference": "4983dff629956490c78b88adcc8ece4711d7d8a3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "url": "https://api.github.com/repos/zendframework/zend-cache/zipball/4983dff629956490c78b88adcc8ece4711d7d8a3", + "reference": "4983dff629956490c78b88adcc8ece4711d7d8a3", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": "^5.6 || ^7.0", + "psr/cache": "^1.0", + "psr/simple-cache": "^1.0", + "zendframework/zend-eventmanager": "^2.6.3 || ^3.2", + "zendframework/zend-servicemanager": "^2.7.8 || ^3.3", + "zendframework/zend-stdlib": "^2.7.7 || ^3.1" + }, + "provide": { + "psr/cache-implementation": "1.0", + "psr/simple-cache-implementation": "1.0" + }, + "require-dev": { + "cache/integration-tests": "^0.16", + "phpbench/phpbench": "^0.13", + "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.2", + "zendframework/zend-coding-standard": "~1.0.0", + "zendframework/zend-serializer": "^2.6", + "zendframework/zend-session": "^2.7.4" + }, + "suggest": { + "ext-apc": "APC or compatible extension, to use the APC storage adapter", + "ext-apcu": "APCU >= 5.1.0, to use the APCu storage adapter", + "ext-dba": "DBA, to use the DBA storage adapter", + "ext-memcache": "Memcache >= 2.0.0 to use the Memcache storage adapter", + "ext-memcached": "Memcached >= 1.0.0 to use the Memcached storage adapter", + "ext-mongo": "Mongo, to use MongoDb storage adapter", + "ext-mongodb": "MongoDB, to use the ExtMongoDb storage adapter", + "ext-redis": "Redis, to use Redis storage adapter", + "ext-wincache": "WinCache, to use the WinCache storage adapter", + "ext-xcache": "XCache, to use the XCache storage adapter", + "mongodb/mongodb": "Required for use with the ext-mongodb adapter", + "mongofill/mongofill": "Alternative to ext-mongo - a pure PHP implementation designed as a drop in replacement", + "zendframework/zend-serializer": "Zend\\Serializer component", + "zendframework/zend-session": "Zend\\Session component" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.8.x-dev", + "dev-develop": "2.9.x-dev" + }, + "zf": { + "component": "Zend\\Cache", + "config-provider": "Zend\\Cache\\ConfigProvider" } }, "autoload": { + "files": [ + "autoload/patternPluginManagerPolyfill.php" + ], "psr-4": { - "Psr\\Container\\": "src/" + "Zend\\Cache\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } + "BSD-3-Clause" ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", + "description": "Caching implementation with a variety of storage options, as well as codified caching strategies for callbacks, classes, and output", "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" + "ZendFramework", + "cache", + "psr-16", + "psr-6", + "zf" ], - "time": "2017-02-14T16:28:37+00:00" + "time": "2018-05-01T21:58:00+00:00" }, { "name": "zendframework/zend-component-installer", @@ -109,248 +1359,505 @@ "malukenho/docheader": "^0.1.6", "mikey179/vfsstream": "^1.6.5", "phpunit/phpunit": "^5.7.23 || ^6.4.3", - "zendframework/zend-coding-standard": "~1.0.0" + "zendframework/zend-coding-standard": "~1.0.0" + }, + "type": "composer-plugin", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev", + "dev-develop": "1.2-dev" + }, + "class": "Zend\\ComponentInstaller\\ComponentInstaller" + }, + "autoload": { + "psr-4": { + "Zend\\ComponentInstaller\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Composer plugin for automating component registration in zend-mvc and Expressive applications", + "keywords": [ + "ZendFramework", + "component installer", + "composer", + "plugin", + "zf" + ], + "time": "2018-01-11T15:03:06+00:00" + }, + { + "name": "zendframework/zend-config", + "version": "3.2.0", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-config.git", + "reference": "6796f5dcba52c84ef2501d7313618989b5ef3023" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-config/zipball/6796f5dcba52c84ef2501d7313618989b5ef3023", + "reference": "6796f5dcba52c84ef2501d7313618989b5ef3023", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": "^5.6 || ^7.0", + "psr/container": "^1.0", + "zendframework/zend-stdlib": "^2.7.7 || ^3.1" + }, + "conflict": { + "container-interop/container-interop": "<1.2.0" + }, + "require-dev": { + "malukenho/docheader": "^0.1.6", + "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.2", + "zendframework/zend-coding-standard": "~1.0.0", + "zendframework/zend-filter": "^2.7.2", + "zendframework/zend-i18n": "^2.7.4", + "zendframework/zend-servicemanager": "^2.7.8 || ^3.3" + }, + "suggest": { + "zendframework/zend-filter": "^2.7.2; install if you want to use the Filter processor", + "zendframework/zend-i18n": "^2.7.4; install if you want to use the Translator processor", + "zendframework/zend-servicemanager": "^2.7.8 || ^3.3; if you need an extensible plugin manager for use with the Config Factory" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2.x-dev", + "dev-develop": "3.3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\Config\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "provides a nested object property based user interface for accessing this configuration data within application code", + "keywords": [ + "ZendFramework", + "config", + "zf" + ], + "time": "2018-04-24T19:26:44+00:00" + }, + { + "name": "zendframework/zend-escaper", + "version": "2.6.0", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-escaper.git", + "reference": "31d8aafae982f9568287cb4dce987e6aff8fd074" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-escaper/zipball/31d8aafae982f9568287cb4dce987e6aff8fd074", + "reference": "31d8aafae982f9568287cb4dce987e6aff8fd074", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.2", + "zendframework/zend-coding-standard": "~1.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6.x-dev", + "dev-develop": "2.7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\Escaper\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Securely and safely escape HTML, HTML attributes, JavaScript, CSS, and URLs", + "keywords": [ + "ZendFramework", + "escaper", + "zf" + ], + "time": "2018-04-25T15:48:53+00:00" + }, + { + "name": "zendframework/zend-eventmanager", + "version": "3.2.1", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-eventmanager.git", + "reference": "a5e2583a211f73604691586b8406ff7296a946dd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-eventmanager/zipball/a5e2583a211f73604691586b8406ff7296a946dd", + "reference": "a5e2583a211f73604691586b8406ff7296a946dd", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "athletic/athletic": "^0.1", + "container-interop/container-interop": "^1.1.0", + "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.2", + "zendframework/zend-coding-standard": "~1.0.0", + "zendframework/zend-stdlib": "^2.7.3 || ^3.0" + }, + "suggest": { + "container-interop/container-interop": "^1.1.0, to use the lazy listeners feature", + "zendframework/zend-stdlib": "^2.7.3 || ^3.0, to use the FilterChain feature" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev", + "dev-develop": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\EventManager\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Trigger and listen to events within a PHP application", + "homepage": "https://github.com/zendframework/zend-eventmanager", + "keywords": [ + "event", + "eventmanager", + "events", + "zf2" + ], + "time": "2018-04-25T15:33:34+00:00" + }, + { + "name": "zendframework/zend-filter", + "version": "2.8.0", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-filter.git", + "reference": "7b997dbe79459f1652deccc8786d7407fb66caa9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-filter/zipball/7b997dbe79459f1652deccc8786d7407fb66caa9", + "reference": "7b997dbe79459f1652deccc8786d7407fb66caa9", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0", + "zendframework/zend-stdlib": "^2.7.7 || ^3.1" + }, + "conflict": { + "zendframework/zend-validator": "<2.10.1" + }, + "require-dev": { + "pear/archive_tar": "^1.4.3", + "phpunit/phpunit": "^5.7.23 || ^6.4.3", + "zendframework/zend-coding-standard": "~1.0.0", + "zendframework/zend-crypt": "^3.2.1", + "zendframework/zend-servicemanager": "^2.7.8 || ^3.3", + "zendframework/zend-uri": "^2.6" }, - "type": "composer-plugin", + "suggest": { + "zendframework/zend-crypt": "Zend\\Crypt component, for encryption filters", + "zendframework/zend-i18n": "Zend\\I18n component for filters depending on i18n functionality", + "zendframework/zend-servicemanager": "Zend\\ServiceManager component, for using the filter chain functionality", + "zendframework/zend-uri": "Zend\\Uri component, for the UriNormalize filter" + }, + "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev", - "dev-develop": "1.2-dev" + "dev-master": "2.8.x-dev", + "dev-develop": "2.9.x-dev" }, - "class": "Zend\\ComponentInstaller\\ComponentInstaller" + "zf": { + "component": "Zend\\Filter", + "config-provider": "Zend\\Filter\\ConfigProvider" + } }, "autoload": { "psr-4": { - "Zend\\ComponentInstaller\\": "src/" + "Zend\\Filter\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "description": "Composer plugin for automating component registration in zend-mvc and Expressive applications", + "description": "provides a set of commonly needed data filters", "keywords": [ "ZendFramework", - "component installer", - "composer", - "plugin", + "filter", "zf" ], - "time": "2018-01-11T15:03:06+00:00" + "time": "2018-04-11T16:20:04+00:00" }, { - "name": "zendframework/zend-config", - "version": "3.2.0", + "name": "zendframework/zend-form", + "version": "2.12.0", "source": { "type": "git", - "url": "https://github.com/zendframework/zend-config.git", - "reference": "6796f5dcba52c84ef2501d7313618989b5ef3023" + "url": "https://github.com/zendframework/zend-form.git", + "reference": "565fb4f4bb3e0dbeea0173c923c4a8be77de9441" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-config/zipball/6796f5dcba52c84ef2501d7313618989b5ef3023", - "reference": "6796f5dcba52c84ef2501d7313618989b5ef3023", + "url": "https://api.github.com/repos/zendframework/zend-form/zipball/565fb4f4bb3e0dbeea0173c923c4a8be77de9441", + "reference": "565fb4f4bb3e0dbeea0173c923c4a8be77de9441", "shasum": "" }, "require": { - "ext-json": "*", "php": "^5.6 || ^7.0", - "psr/container": "^1.0", - "zendframework/zend-stdlib": "^2.7.7 || ^3.1" - }, - "conflict": { - "container-interop/container-interop": "<1.2.0" + "zendframework/zend-hydrator": "^1.1 || ^2.1", + "zendframework/zend-inputfilter": "^2.8", + "zendframework/zend-stdlib": "^2.7 || ^3.0" }, "require-dev": { - "malukenho/docheader": "^0.1.6", - "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.2", + "doctrine/annotations": "~1.0", + "phpunit/phpunit": "^5.7.23 || ^6.5.3", + "zendframework/zend-cache": "^2.6.1", + "zendframework/zend-captcha": "^2.7.1", + "zendframework/zend-code": "^2.6 || ^3.0", "zendframework/zend-coding-standard": "~1.0.0", - "zendframework/zend-filter": "^2.7.2", - "zendframework/zend-i18n": "^2.7.4", - "zendframework/zend-servicemanager": "^2.7.8 || ^3.3" + "zendframework/zend-escaper": "^2.5", + "zendframework/zend-eventmanager": "^2.6.2 || ^3.0", + "zendframework/zend-filter": "^2.6", + "zendframework/zend-i18n": "^2.6", + "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3", + "zendframework/zend-session": "^2.8.1", + "zendframework/zend-text": "^2.6", + "zendframework/zend-validator": "^2.6", + "zendframework/zend-view": "^2.6.2", + "zendframework/zendservice-recaptcha": "^3.0.0" }, "suggest": { - "zendframework/zend-filter": "^2.7.2; install if you want to use the Filter processor", - "zendframework/zend-i18n": "^2.7.4; install if you want to use the Translator processor", - "zendframework/zend-servicemanager": "^2.7.8 || ^3.3; if you need an extensible plugin manager for use with the Config Factory" + "zendframework/zend-captcha": "^2.7.1, required for using CAPTCHA form elements", + "zendframework/zend-code": "^2.6 || ^3.0, required to use zend-form annotations support", + "zendframework/zend-eventmanager": "^2.6.2 || ^3.0, reuired for zend-form annotations support", + "zendframework/zend-i18n": "^2.6, required when using zend-form view helpers", + "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3, required to use the form factories or provide services", + "zendframework/zend-view": "^2.6.2, required for using the zend-form view helpers", + "zendframework/zendservice-recaptcha": "in order to use the ReCaptcha form element" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2.x-dev", - "dev-develop": "3.3.x-dev" + "dev-master": "2.12.x-dev", + "dev-develop": "2.13.x-dev" + }, + "zf": { + "component": "Zend\\Form", + "config-provider": "Zend\\Form\\ConfigProvider" } }, "autoload": { "psr-4": { - "Zend\\Config\\": "src/" - } + "Zend\\Form\\": "src/" + }, + "files": [ + "autoload/formElementManagerPolyfill.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "description": "provides a nested object property based user interface for accessing this configuration data within application code", + "description": "Validate and display simple and complex forms, casting forms to business objects and vice versa", "keywords": [ "ZendFramework", - "config", + "form", "zf" ], - "time": "2018-04-24T19:26:44+00:00" + "time": "2018-05-16T18:49:44+00:00" }, { - "name": "zendframework/zend-escaper", - "version": "2.6.0", + "name": "zendframework/zend-http", + "version": "2.8.0", "source": { "type": "git", - "url": "https://github.com/zendframework/zend-escaper.git", - "reference": "31d8aafae982f9568287cb4dce987e6aff8fd074" + "url": "https://github.com/zendframework/zend-http.git", + "reference": "f48b276ffa11b48dd1ae3c6bc306d6ed7958ef51" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-escaper/zipball/31d8aafae982f9568287cb4dce987e6aff8fd074", - "reference": "31d8aafae982f9568287cb4dce987e6aff8fd074", + "url": "https://api.github.com/repos/zendframework/zend-http/zipball/f48b276ffa11b48dd1ae3c6bc306d6ed7958ef51", + "reference": "f48b276ffa11b48dd1ae3c6bc306d6ed7958ef51", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": "^5.6 || ^7.0", + "zendframework/zend-loader": "^2.5.1", + "zendframework/zend-stdlib": "^3.1 || ^2.7.7", + "zendframework/zend-uri": "^2.5.2", + "zendframework/zend-validator": "^2.10.1" }, "require-dev": { - "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.2", - "zendframework/zend-coding-standard": "~1.0.0" + "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.3", + "zendframework/zend-coding-standard": "~1.0.0", + "zendframework/zend-config": "^3.1 || ^2.6" + }, + "suggest": { + "paragonie/certainty": "For automated management of cacert.pem" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6.x-dev", - "dev-develop": "2.7.x-dev" + "dev-master": "2.8.x-dev", + "dev-develop": "2.9.x-dev" } }, "autoload": { "psr-4": { - "Zend\\Escaper\\": "src/" + "Zend\\Http\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "description": "Securely and safely escape HTML, HTML attributes, JavaScript, CSS, and URLs", + "description": "Provides an easy interface for performing Hyper-Text Transfer Protocol (HTTP) requests", "keywords": [ "ZendFramework", - "escaper", + "http", + "http client", + "zend", "zf" ], - "time": "2018-04-25T15:48:53+00:00" + "time": "2018-04-26T21:04:50+00:00" }, { - "name": "zendframework/zend-eventmanager", - "version": "3.2.1", + "name": "zendframework/zend-hydrator", + "version": "2.4.0", "source": { "type": "git", - "url": "https://github.com/zendframework/zend-eventmanager.git", - "reference": "a5e2583a211f73604691586b8406ff7296a946dd" + "url": "https://github.com/zendframework/zend-hydrator.git", + "reference": "bd48bc3bc046df007a94125f868dd1aa1b73a813" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-eventmanager/zipball/a5e2583a211f73604691586b8406ff7296a946dd", - "reference": "a5e2583a211f73604691586b8406ff7296a946dd", + "url": "https://api.github.com/repos/zendframework/zend-hydrator/zipball/bd48bc3bc046df007a94125f868dd1aa1b73a813", + "reference": "bd48bc3bc046df007a94125f868dd1aa1b73a813", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": "^5.6 || ^7.0", + "zendframework/zend-stdlib": "^3.0" }, "require-dev": { - "athletic/athletic": "^0.1", - "container-interop/container-interop": "^1.1.0", "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.2", "zendframework/zend-coding-standard": "~1.0.0", - "zendframework/zend-stdlib": "^2.7.3 || ^3.0" + "zendframework/zend-eventmanager": "^2.6.2 || ^3.0", + "zendframework/zend-filter": "^2.6", + "zendframework/zend-inputfilter": "^2.6", + "zendframework/zend-serializer": "^2.6.1", + "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3" }, "suggest": { - "container-interop/container-interop": "^1.1.0, to use the lazy listeners feature", - "zendframework/zend-stdlib": "^2.7.3 || ^3.0, to use the FilterChain feature" + "zendframework/zend-eventmanager": "^2.6.2 || ^3.0, to support aggregate hydrator usage", + "zendframework/zend-filter": "^2.6, to support naming strategy hydrator usage", + "zendframework/zend-serializer": "^2.6.1, to use the SerializableStrategy", + "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3, to support hydrator plugin manager usage" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev", - "dev-develop": "3.3-dev" + "dev-release-1.0": "1.0.x-dev", + "dev-release-1.1": "1.1.x-dev", + "dev-master": "2.4.x-dev", + "dev-develop": "2.5.x-dev" + }, + "zf": { + "component": "Zend\\Hydrator", + "config-provider": "Zend\\Hydrator\\ConfigProvider" } }, "autoload": { "psr-4": { - "Zend\\EventManager\\": "src/" + "Zend\\Hydrator\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "description": "Trigger and listen to events within a PHP application", - "homepage": "https://github.com/zendframework/zend-eventmanager", + "description": "Serialize objects to arrays, and vice versa", "keywords": [ - "event", - "eventmanager", - "events", - "zf2" + "ZendFramework", + "hydrator", + "zf" ], - "time": "2018-04-25T15:33:34+00:00" + "time": "2018-04-30T21:22:14+00:00" }, { - "name": "zendframework/zend-http", - "version": "2.8.0", + "name": "zendframework/zend-inputfilter", + "version": "2.8.2", "source": { "type": "git", - "url": "https://github.com/zendframework/zend-http.git", - "reference": "f48b276ffa11b48dd1ae3c6bc306d6ed7958ef51" + "url": "https://github.com/zendframework/zend-inputfilter.git", + "reference": "3f02179e014d9ef0faccda2ad6c65d38adc338d8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-http/zipball/f48b276ffa11b48dd1ae3c6bc306d6ed7958ef51", - "reference": "f48b276ffa11b48dd1ae3c6bc306d6ed7958ef51", + "url": "https://api.github.com/repos/zendframework/zend-inputfilter/zipball/3f02179e014d9ef0faccda2ad6c65d38adc338d8", + "reference": "3f02179e014d9ef0faccda2ad6c65d38adc338d8", "shasum": "" }, "require": { "php": "^5.6 || ^7.0", - "zendframework/zend-loader": "^2.5.1", - "zendframework/zend-stdlib": "^3.1 || ^2.7.7", - "zendframework/zend-uri": "^2.5.2", + "zendframework/zend-filter": "^2.6", + "zendframework/zend-servicemanager": "^2.7.10 || ^3.3.1", + "zendframework/zend-stdlib": "^2.7 || ^3.0", "zendframework/zend-validator": "^2.10.1" }, "require-dev": { - "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.3", - "zendframework/zend-coding-standard": "~1.0.0", - "zendframework/zend-config": "^3.1 || ^2.6" - }, - "suggest": { - "paragonie/certainty": "For automated management of cacert.pem" + "phpunit/phpunit": "^5.7.23 || ^6.4.3", + "zendframework/zend-coding-standard": "~1.0.0" }, "type": "library", "extra": { "branch-alias": { "dev-master": "2.8.x-dev", "dev-develop": "2.9.x-dev" + }, + "zf": { + "component": "Zend\\InputFilter", + "config-provider": "Zend\\InputFilter\\ConfigProvider" } }, "autoload": { "psr-4": { - "Zend\\Http\\": "src/" + "Zend\\InputFilter\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "description": "Provides an easy interface for performing Hyper-Text Transfer Protocol (HTTP) requests", + "description": "Normalize and validate input sets from the web, APIs, the CLI, and more, including files", "keywords": [ "ZendFramework", - "http", - "http client", - "zend", + "inputfilter", "zf" ], - "time": "2018-04-26T21:04:50+00:00" + "time": "2018-05-14T17:38:03+00:00" }, { "name": "zendframework/zend-loader", @@ -529,6 +2036,71 @@ ], "time": "2017-11-24T06:32:07+00:00" }, + { + "name": "zendframework/zend-paginator", + "version": "2.8.1", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-paginator.git", + "reference": "fd58828c8280a90f133b9e0af2fe1a7885d47206" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-paginator/zipball/fd58828c8280a90f133b9e0af2fe1a7885d47206", + "reference": "fd58828c8280a90f133b9e0af2fe1a7885d47206", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^5.6", + "zendframework/zend-stdlib": "^2.7 || ^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.2.1 || ^5.7.15", + "zendframework/zend-cache": "^2.6.1", + "zendframework/zend-coding-standard": "~1.0.0", + "zendframework/zend-config": "^2.6.0", + "zendframework/zend-db": "^2.9.2", + "zendframework/zend-filter": "^2.6.1", + "zendframework/zend-json": "^2.6.1", + "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3", + "zendframework/zend-view": "^2.6.3" + }, + "suggest": { + "zendframework/zend-cache": "Zend\\Cache component to support cache features", + "zendframework/zend-db": "Zend\\Db component", + "zendframework/zend-filter": "Zend\\Filter component", + "zendframework/zend-json": "Zend\\Json component", + "zendframework/zend-servicemanager": "Zend\\ServiceManager component", + "zendframework/zend-view": "Zend\\View component" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev", + "dev-develop": "2.9-dev" + }, + "zf": { + "component": "Zend\\Paginator", + "config-provider": "Zend\\Paginator\\ConfigProvider" + } + }, + "autoload": { + "psr-4": { + "Zend\\Paginator\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "zend-paginator is a flexible component for paginating collections of data and presenting that data to users.", + "homepage": "https://github.com/zendframework/zend-paginator", + "keywords": [ + "paginator", + "zf2" + ], + "time": "2018-01-30T15:52:44+00:00" + }, { "name": "zendframework/zend-router", "version": "3.1.0", @@ -912,60 +2484,6 @@ } ], "packages-dev": [ - { - "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-14T21:17:01+00:00" - }, { "name": "myclabs/deep-copy", "version": "1.7.0", @@ -1579,16 +3097,16 @@ }, { "name": "phpunit/phpunit", - "version": "6.5.8", + "version": "6.5.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "4f21a3c6b97c42952fd5c2837bb354ec0199b97b" + "reference": "093ca5508174cd8ab8efe44fd1dde447adfdec8f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/4f21a3c6b97c42952fd5c2837bb354ec0199b97b", - "reference": "4f21a3c6b97c42952fd5c2837bb354ec0199b97b", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/093ca5508174cd8ab8efe44fd1dde447adfdec8f", + "reference": "093ca5508174cd8ab8efe44fd1dde447adfdec8f", "shasum": "" }, "require": { @@ -1659,7 +3177,7 @@ "testing", "xunit" ], - "time": "2018-04-10T11:38:34+00:00" + "time": "2018-07-03T06:40:40+00:00" }, { "name": "phpunit/phpunit-mock-objects", diff --git a/config/autoload/doctrine.docker.php b/config/autoload/doctrine.docker.php new file mode 100644 index 0000000..bb911e6 --- /dev/null +++ b/config/autoload/doctrine.docker.php @@ -0,0 +1,18 @@ + [ + 'connection' => [ + // default connection name + 'orm_default' => [ + 'driverClass' => \Doctrine\DBAL\Driver\PDOMySql\Driver::class, + 'params' => [ + 'host' => 'db', + 'port' => '3306', + 'user' => 'app', + 'password' => 'app', + 'dbname' => 'app', + ], + ], + ], + ], +]; diff --git a/config/autoload/doctrine.global.php b/config/autoload/doctrine.global.php new file mode 100644 index 0000000..a6d4624 --- /dev/null +++ b/config/autoload/doctrine.global.php @@ -0,0 +1,27 @@ + [ + 'driver' => [ + // defines an annotation driver, named `annotation_driver` + 'annotation_driver' => [ + 'class' => \Doctrine\ORM\Mapping\Driver\AnnotationDriver::class, + 'cache' => 'array', + 'paths' => [ + realpath(__DIR__ . '/../../module/Application/src/Entity'), + ], + ], + // default metadata driver, aggregates all other drivers into a single one. + // Override `orm_default` only if you know what you're doing + 'orm_default' => [ + 'drivers' => [ + // register `annotation_driver` for any entity under namespace `Application\Entity` + 'Application\Entity' => 'annotation_driver', + ], + ], + ], + ], +]; diff --git a/config/modules.config.php b/config/modules.config.php index 1913926..f43361a 100644 --- a/config/modules.config.php +++ b/config/modules.config.php @@ -8,6 +8,8 @@ return [ 'Zend\Router', 'Zend\Validator', + 'DoctrineModule', + 'DoctrineORMModule', 'Application', 'Product', 'Category', From f947f672eb8c7bb01e764a76c5a7becfb73668a7 Mon Sep 17 00:00:00 2001 From: Mohamed Mahdy Date: Wed, 4 Jul 2018 12:35:23 +0200 Subject: [PATCH 05/18] new product category doctrine schema --- module/Category/Entity/Category.php | 29 ++++++++++++++++++++ module/Product/Entity/Category.php | 41 +++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 module/Category/Entity/Category.php create mode 100644 module/Product/Entity/Category.php diff --git a/module/Category/Entity/Category.php b/module/Category/Entity/Category.php new file mode 100644 index 0000000..2adee05 --- /dev/null +++ b/module/Category/Entity/Category.php @@ -0,0 +1,29 @@ + Date: Wed, 4 Jul 2018 17:30:44 +0200 Subject: [PATCH 06/18] init & fix doctorine schema driver paths and start with show products --- Dockerfile | 1 - config/autoload/doctrine.global.php | 7 ++++--- module/Product/src/Controller/ProductController.php | 3 ++- .../{Entity/Category.php => src/Entity/Product.php} | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) rename module/Product/{Entity/Category.php => src/Entity/Product.php} (96%) diff --git a/Dockerfile b/Dockerfile index ab3f9c3..82860ec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,6 @@ RUN apt-get update \ && apt-get install -y git zlib1g-dev \ && docker-php-ext-install zip \ && docker-php-ext-install pdo_mysql \ - && a2enmod rewrite \ && sed -i 's!/var/www/html!/var/www/public!g' /etc/apache2/sites-available/000-default.conf \ && mv /var/www/html /var/www/public \ diff --git a/config/autoload/doctrine.global.php b/config/autoload/doctrine.global.php index a6d4624..3b09564 100644 --- a/config/autoload/doctrine.global.php +++ b/config/autoload/doctrine.global.php @@ -2,7 +2,6 @@ /** * Doctrine Global Config */ - return [ 'doctrine' => [ 'driver' => [ @@ -11,7 +10,8 @@ 'class' => \Doctrine\ORM\Mapping\Driver\AnnotationDriver::class, 'cache' => 'array', 'paths' => [ - realpath(__DIR__ . '/../../module/Application/src/Entity'), + realpath(__DIR__ . '/../../module/Product/src/Entity'), + realpath(__DIR__ . '/../../module/Category/src/Entity'), ], ], // default metadata driver, aggregates all other drivers into a single one. @@ -19,7 +19,8 @@ 'orm_default' => [ 'drivers' => [ // register `annotation_driver` for any entity under namespace `Application\Entity` - 'Application\Entity' => 'annotation_driver', + 'Product\Entity' => 'annotation_driver', + 'Category\Entity' => 'annotation_driver', ], ], ], diff --git a/module/Product/src/Controller/ProductController.php b/module/Product/src/Controller/ProductController.php index 842b459..18862a2 100644 --- a/module/Product/src/Controller/ProductController.php +++ b/module/Product/src/Controller/ProductController.php @@ -10,7 +10,8 @@ class ProductController extends AbstractActionController public function indexAction() { //echo 'ok'; die; - return new ViewModel(); + $users = $this->getObjectManager()->getRepository('\Application\Entity\User')->findAll(); + return new ViewModel(array('products' => $products)); } public function addAction() diff --git a/module/Product/Entity/Category.php b/module/Product/src/Entity/Product.php similarity index 96% rename from module/Product/Entity/Category.php rename to module/Product/src/Entity/Product.php index 3ba52a0..3069149 100644 --- a/module/Product/Entity/Category.php +++ b/module/Product/src/Entity/Product.php @@ -24,7 +24,7 @@ class Product * @ORM\Column(type="string") * @var string */ - private $name; + private $title; /** * @ORM\Column(type="text") From c35814699f58d64c9364aff4782b150ea5757f2c Mon Sep 17 00:00:00 2001 From: Mohamed Mahdy Date: Wed, 4 Jul 2018 19:43:11 +0200 Subject: [PATCH 07/18] fixes + models methods main structure --- module/Category/config/module.config.php | 2 +- .../src/Controller/CategoryController.php | 15 ++++++- .../Controller/CategoryControllerFactory.php | 45 +++++++++++++++++++ module/Category/{ => src}/Entity/Category.php | 0 .../src/Repository/CategoryRepository.php | 43 ++++++++++++++++++ .../src/Controller/ProductController.php | 6 ++- .../src/Repository/ProductRepository.php | 29 ++++++++++++ 7 files changed, 136 insertions(+), 4 deletions(-) create mode 100644 module/Category/src/Controller/CategoryControllerFactory.php rename module/Category/{ => src}/Entity/Category.php (100%) create mode 100644 module/Category/src/Repository/CategoryRepository.php create mode 100644 module/Product/src/Repository/ProductRepository.php diff --git a/module/Category/config/module.config.php b/module/Category/config/module.config.php index 67ba112..aeaa4de 100644 --- a/module/Category/config/module.config.php +++ b/module/Category/config/module.config.php @@ -23,7 +23,7 @@ ], 'controllers' => [ 'factories' => [ - Controller\CategoryController::class => InvokableFactory::class, + Controller\CategoryController::class => Controller\CategoryControllerFactory::class, ], ], 'view_manager' => [ diff --git a/module/Category/src/Controller/CategoryController.php b/module/Category/src/Controller/CategoryController.php index 8a0e8e9..35a1a3c 100644 --- a/module/Category/src/Controller/CategoryController.php +++ b/module/Category/src/Controller/CategoryController.php @@ -4,13 +4,26 @@ use Zend\Mvc\Controller\AbstractActionController; use Zend\View\Model\ViewModel; +use Doctrine\ORM\EntityManager; +use Category\Repository\CategoryRepository; class CategoryController extends AbstractActionController { + private $entityManager; + + public function __construct($serviceManager) + { + $this->entityManager = $serviceManager->get(EntityManager::class); + } + public function indexAction() { //echo 'ok'; die; - return new ViewModel(); + $categories = new CategoryRepository($this->entityManager); + + $data = $categories->findAll(); + // $products = $this->entityManager; + return new ViewModel(['categories' => $data]); } public function addAction() diff --git a/module/Category/src/Controller/CategoryControllerFactory.php b/module/Category/src/Controller/CategoryControllerFactory.php new file mode 100644 index 0000000..1236cb3 --- /dev/null +++ b/module/Category/src/Controller/CategoryControllerFactory.php @@ -0,0 +1,45 @@ +get('doctrine.entitymanager.orm_default'); +// var_dump(get_class($entityManager));exit; + // Instantiate the controller and inject dependencies + return new CategoryController($container); +// $service = (null === $options) ? new $requestedName : new $requestedName($options); +// return $service->setServiceManager($container); + + } +} \ No newline at end of file diff --git a/module/Category/Entity/Category.php b/module/Category/src/Entity/Category.php similarity index 100% rename from module/Category/Entity/Category.php rename to module/Category/src/Entity/Category.php diff --git a/module/Category/src/Repository/CategoryRepository.php b/module/Category/src/Repository/CategoryRepository.php new file mode 100644 index 0000000..0ccc6fe --- /dev/null +++ b/module/Category/src/Repository/CategoryRepository.php @@ -0,0 +1,43 @@ +entityManager = $entityManager; + } + + /** + * Retrieves all published posts in descending date order. + * @return Query + */ + public function findAll() + { + // $entityManager = $this->getEntityManager(); + $categoryRepository = $this->entityManager->getRepository(Category::class); + return $categoryRepository->findAll(); + // $data = $this->entityManager->find('Category\Entity\Category',521); + } + + // add - update method + public function save(){ + + } + + // add - update method + public function delete(){ + + } + + +} diff --git a/module/Product/src/Controller/ProductController.php b/module/Product/src/Controller/ProductController.php index 18862a2..62d1209 100644 --- a/module/Product/src/Controller/ProductController.php +++ b/module/Product/src/Controller/ProductController.php @@ -4,14 +4,16 @@ use Zend\Mvc\Controller\AbstractActionController; use Zend\View\Model\ViewModel; +use Product\Repository\ProductRepository; class ProductController extends AbstractActionController { public function indexAction() { //echo 'ok'; die; - $users = $this->getObjectManager()->getRepository('\Application\Entity\User')->findAll(); - return new ViewModel(array('products' => $products)); + //$products = new Product\src\Repository\ProductRepository(); + //$data = $products->findPublishedProducts(); + return new ViewModel(array('products' => $data)); } public function addAction() diff --git a/module/Product/src/Repository/ProductRepository.php b/module/Product/src/Repository/ProductRepository.php new file mode 100644 index 0000000..dc4995a --- /dev/null +++ b/module/Product/src/Repository/ProductRepository.php @@ -0,0 +1,29 @@ + Date: Thu, 5 Jul 2018 11:28:53 +0200 Subject: [PATCH 08/18] Add new category --- module/Category/config/module.config.php | 22 ++++++++++++++- .../src/Controller/CategoryController.php | 15 ++++++++-- module/Category/src/Entity/Category.php | 20 +++++++++++++ .../src/Repository/CategoryRepository.php | 14 ++++++++-- module/Category/view/category/add.phtml | 28 +++++++++++++++++++ module/Category/view/category/index.phtml | 4 +-- 6 files changed, 94 insertions(+), 9 deletions(-) create mode 100644 module/Category/view/category/add.phtml diff --git a/module/Category/config/module.config.php b/module/Category/config/module.config.php index aeaa4de..73e30d8 100644 --- a/module/Category/config/module.config.php +++ b/module/Category/config/module.config.php @@ -19,6 +19,26 @@ ], ], ], + 'category-add' => [ + 'type' => Segment::class, + 'options' => [ + 'route' => '/category/add', + 'defaults' => [ + 'controller' => Controller\CategoryController::class, + 'action' => 'add', + ], + ], + ], + 'category-add-ajax' => [ + 'type' => Segment::class, + 'options' => [ + 'route' => '/category/post', + 'defaults' => [ + 'controller' => Controller\CategoryController::class, + 'action' => 'addAjax', + ], + ], + ], ], ], 'controllers' => [ @@ -35,7 +55,7 @@ 'template_map' => [ 'layout/layout' => __DIR__ . '/../../../themes/default/layout/layout.phtml', 'category/category/index' => __DIR__ . '/../view/category/index.phtml', - // 'catalog/catalog/add' => __DIR__ . '/../view/catalog/add.phtml', + 'category/category/add' => __DIR__ . '/../view/category/add.phtml', // 'catalog/catalog/edit' => __DIR__ . '/../view/catalog/edit.phtml', 'error/404' => __DIR__ . '/../view/error/404.phtml', 'error/index' => __DIR__ . '/../view/error/index.phtml', diff --git a/module/Category/src/Controller/CategoryController.php b/module/Category/src/Controller/CategoryController.php index 35a1a3c..ec821c4 100644 --- a/module/Category/src/Controller/CategoryController.php +++ b/module/Category/src/Controller/CategoryController.php @@ -18,11 +18,8 @@ public function __construct($serviceManager) public function indexAction() { - //echo 'ok'; die; $categories = new CategoryRepository($this->entityManager); - $data = $categories->findAll(); - // $products = $this->entityManager; return new ViewModel(['categories' => $data]); } @@ -31,6 +28,18 @@ public function addAction() return new ViewModel(); } + public function addAjaxAction() + { + if($this->getRequest()->isPost()) { + $category = new CategoryRepository($this->entityManager); + // Fill in the form with POST data + $data = $this->params()->fromPost(); + // var_dump($data); + $category->save($data); + } + die; + } + public function editAction() { return new ViewModel(); diff --git a/module/Category/src/Entity/Category.php b/module/Category/src/Entity/Category.php index 2adee05..22a7519 100644 --- a/module/Category/src/Entity/Category.php +++ b/module/Category/src/Entity/Category.php @@ -26,4 +26,24 @@ class Category */ private $name; + + public function setName($name) + { + $this->name = $name; + } + + public function getName() + { + return $this->name; + } + + public function setId($id) + { + $this->id = $id; + } + + public function getId() + { + return $this->id; + } } diff --git a/module/Category/src/Repository/CategoryRepository.php b/module/Category/src/Repository/CategoryRepository.php index 0ccc6fe..1c4f4df 100644 --- a/module/Category/src/Repository/CategoryRepository.php +++ b/module/Category/src/Repository/CategoryRepository.php @@ -23,14 +23,22 @@ public function __construct($entityManager) */ public function findAll() { - // $entityManager = $this->getEntityManager(); $categoryRepository = $this->entityManager->getRepository(Category::class); return $categoryRepository->findAll(); - // $data = $this->entityManager->find('Category\Entity\Category',521); } // add - update method - public function save(){ + public function save($data){ + // Create new Post entity. + $category = new Category(); + // $category->name = $data['name']; + $category->setName('Phone'); + + // Add the entity to entity manager. + $this->entityManager->persist($category); + + // Apply changes to database. + $this->entityManager->flush(); } diff --git a/module/Category/view/category/add.phtml b/module/Category/view/category/add.phtml new file mode 100644 index 0000000..7bd9ca2 --- /dev/null +++ b/module/Category/view/category/add.phtml @@ -0,0 +1,28 @@ +
+

Manage Categories

+
+ +
+ + All Categories +

+
+

Add new Category

+ +
+ +
+ +
+
+ diff --git a/module/Category/view/category/index.phtml b/module/Category/view/category/index.phtml index 32dd426..86cfc5e 100644 --- a/module/Category/view/category/index.phtml +++ b/module/Category/view/category/index.phtml @@ -2,8 +2,8 @@

Manage Categories

-
- + Add new Category +
+ + Add new Category

From 8f9e1bf0ac31c96acda0589f57c5ee83410350b7 Mon Sep 17 00:00:00 2001 From: Mohamed Mahdy Date: Thu, 5 Jul 2018 11:36:00 +0200 Subject: [PATCH 09/18] show all categories in table --- module/Category/src/Entity/Category.php | 4 +-- .../src/Repository/CategoryRepository.php | 2 +- module/Category/view/category/index.phtml | 32 +++++++------------ 3 files changed, 14 insertions(+), 24 deletions(-) diff --git a/module/Category/src/Entity/Category.php b/module/Category/src/Entity/Category.php index 22a7519..b0c154a 100644 --- a/module/Category/src/Entity/Category.php +++ b/module/Category/src/Entity/Category.php @@ -18,13 +18,13 @@ class Category * @ORM\GeneratedValue(strategy="AUTO") * @var integer */ - private $id; + public $id; /** * @ORM\Column(type="string") * @var string */ - private $name; + public $name; public function setName($name) diff --git a/module/Category/src/Repository/CategoryRepository.php b/module/Category/src/Repository/CategoryRepository.php index 1c4f4df..76754d6 100644 --- a/module/Category/src/Repository/CategoryRepository.php +++ b/module/Category/src/Repository/CategoryRepository.php @@ -32,7 +32,7 @@ public function save($data){ // Create new Post entity. $category = new Category(); // $category->name = $data['name']; - $category->setName('Phone'); + $category->setName($data['name']); // Add the entity to entity manager. $this->entityManager->persist($category); diff --git a/module/Category/view/category/index.phtml b/module/Category/view/category/index.phtml index 86cfc5e..fcebf58 100644 --- a/module/Category/view/category/index.phtml +++ b/module/Category/view/category/index.phtml @@ -6,6 +6,12 @@ + Add new Category

+ "; + // var_dump($categories); + // echo ""; + + ?> @@ -13,32 +19,16 @@ + - - - - - - - - - - - - + + +
IDAction
1Cat name - View Products - Edit - Delete -
2Cat name - View Products - Edit - Delete -
3category nameid ?>name ?> - View Products + View Products Edit Delete
From 71ed690e94748078c7bb2e6be61eb8ea3d06f1e8 Mon Sep 17 00:00:00 2001 From: Mohamed Mahdy Date: Thu, 5 Jul 2018 12:26:00 +0200 Subject: [PATCH 10/18] edit category --- module/Category/config/module.config.php | 22 +++++++++++++- .../src/Controller/CategoryController.php | 20 +++++++++++-- .../src/Repository/CategoryRepository.php | 30 +++++++++++++++++-- module/Category/view/category/edit.phtml | 26 ++++++++++++++++ module/Category/view/category/index.phtml | 2 +- 5 files changed, 94 insertions(+), 6 deletions(-) create mode 100644 module/Category/view/category/edit.phtml diff --git a/module/Category/config/module.config.php b/module/Category/config/module.config.php index 73e30d8..cdaabdf 100644 --- a/module/Category/config/module.config.php +++ b/module/Category/config/module.config.php @@ -29,6 +29,16 @@ ], ], ], + 'category-edit' => [ + 'type' => Segment::class, + 'options' => [ + 'route' => '/category/edit[/:id]', + 'defaults' => [ + 'controller' => Controller\CategoryController::class, + 'action' => 'edit', + ], + ], + ], 'category-add-ajax' => [ 'type' => Segment::class, 'options' => [ @@ -39,6 +49,16 @@ ], ], ], + 'category-edit-ajax' => [ + 'type' => Segment::class, + 'options' => [ + 'route' => '/category/update', + 'defaults' => [ + 'controller' => Controller\CategoryController::class, + 'action' => 'updateAjax', + ], + ], + ], ], ], 'controllers' => [ @@ -56,7 +76,7 @@ 'layout/layout' => __DIR__ . '/../../../themes/default/layout/layout.phtml', 'category/category/index' => __DIR__ . '/../view/category/index.phtml', 'category/category/add' => __DIR__ . '/../view/category/add.phtml', - // 'catalog/catalog/edit' => __DIR__ . '/../view/catalog/edit.phtml', + 'category/category/edit' => __DIR__ . '/../view/category/edit.phtml', 'error/404' => __DIR__ . '/../view/error/404.phtml', 'error/index' => __DIR__ . '/../view/error/index.phtml', ], diff --git a/module/Category/src/Controller/CategoryController.php b/module/Category/src/Controller/CategoryController.php index ec821c4..0ba633b 100644 --- a/module/Category/src/Controller/CategoryController.php +++ b/module/Category/src/Controller/CategoryController.php @@ -35,13 +35,29 @@ public function addAjaxAction() // Fill in the form with POST data $data = $this->params()->fromPost(); // var_dump($data); - $category->save($data); + $category->create($data); } die; } public function editAction() { - return new ViewModel(); + // Get post ID. + $id = (int)$this->params()->fromRoute('id', -1); + $category = new CategoryRepository($this->entityManager); + $data = $category->find($id); + + return new ViewModel(['category' => $data]); + } + + public function updateAjaxAction() + { + if($this->getRequest()->isPost()) { + $category = new CategoryRepository($this->entityManager); + // Fill in the form with POST data + $data = $this->params()->fromPost(); + $category->update($data); + } + die; } } diff --git a/module/Category/src/Repository/CategoryRepository.php b/module/Category/src/Repository/CategoryRepository.php index 76754d6..ee10e80 100644 --- a/module/Category/src/Repository/CategoryRepository.php +++ b/module/Category/src/Repository/CategoryRepository.php @@ -27,8 +27,19 @@ public function findAll() return $categoryRepository->findAll(); } - // add - update method - public function save($data){ + public function find($id){ + $row = $this->entityManager->getRepository(Category::class) + ->findOneById($id); + return $row; + } + + public function findObj($id){ + $row = $this->entityManager->getRepository(Category::class)->find($id); + return $row; + } + + // add method + public function create($data){ // Create new Post entity. $category = new Category(); // $category->name = $data['name']; @@ -42,6 +53,21 @@ public function save($data){ } + // update method + public function update($data){ + + $category = new Category(); + $category->setId($data['id']); + $category->setName($data['name']); + + // Add the entity to entity manager. + $this->entityManager->merge($category); + + // Apply changes to database. + $this->entityManager->flush(); + + } + // add - update method public function delete(){ diff --git a/module/Category/view/category/edit.phtml b/module/Category/view/category/edit.phtml new file mode 100644 index 0000000..f8de1bb --- /dev/null +++ b/module/Category/view/category/edit.phtml @@ -0,0 +1,26 @@ +
+

Edit Category Information

+
+
+ + All Categories +

+
+ +
+ +
+ +
+
+ diff --git a/module/Category/view/category/index.phtml b/module/Category/view/category/index.phtml index fcebf58..bcfc00e 100644 --- a/module/Category/view/category/index.phtml +++ b/module/Category/view/category/index.phtml @@ -25,7 +25,7 @@ name ?> View Products - Edit + Edit Delete From 72c737b57453275f6d7fcfe094a8ffa033610967 Mon Sep 17 00:00:00 2001 From: Mohamed Mahdy Date: Thu, 5 Jul 2018 13:10:37 +0200 Subject: [PATCH 11/18] Delete category --- module/Category/config/module.config.php | 10 +++++++ .../src/Controller/CategoryController.php | 13 +++++++++ .../src/Repository/CategoryRepository.php | 9 ++++--- module/Category/view/category/add.phtml | 1 + module/Category/view/category/index.phtml | 27 ++++++++++++++----- 5 files changed, 50 insertions(+), 10 deletions(-) diff --git a/module/Category/config/module.config.php b/module/Category/config/module.config.php index cdaabdf..8b073c8 100644 --- a/module/Category/config/module.config.php +++ b/module/Category/config/module.config.php @@ -59,6 +59,16 @@ ], ], ], + 'category-delete' => [ + 'type' => Segment::class, + 'options' => [ + 'route' => '/category/delete', + 'defaults' => [ + 'controller' => Controller\CategoryController::class, + 'action' => 'deleteAjax', + ], + ], + ], ], ], 'controllers' => [ diff --git a/module/Category/src/Controller/CategoryController.php b/module/Category/src/Controller/CategoryController.php index 0ba633b..dffba28 100644 --- a/module/Category/src/Controller/CategoryController.php +++ b/module/Category/src/Controller/CategoryController.php @@ -60,4 +60,17 @@ public function updateAjaxAction() } die; } + + public function deleteAjaxAction() + { + if($this->getRequest()->isPost()) { + $category = new CategoryRepository($this->entityManager); + // Fill in the form with POST data + //$id = (int)$this->params()->fromRoute('id', -1); + $data = $this->params()->fromPost(); + $category->delete($data); + } + // echo $id; + die; + } } diff --git a/module/Category/src/Repository/CategoryRepository.php b/module/Category/src/Repository/CategoryRepository.php index ee10e80..c576c3d 100644 --- a/module/Category/src/Repository/CategoryRepository.php +++ b/module/Category/src/Repository/CategoryRepository.php @@ -68,9 +68,12 @@ public function update($data){ } - // add - update method - public function delete(){ - + // delete cateogry method + public function delete($data){ + $category = $this->findObj($data['id']); + $this->entityManager->remove($category); + // Apply changes to database. + $this->entityManager->flush(); } diff --git a/module/Category/view/category/add.phtml b/module/Category/view/category/add.phtml index 7bd9ca2..44d82d8 100644 --- a/module/Category/view/category/add.phtml +++ b/module/Category/view/category/add.phtml @@ -22,6 +22,7 @@ $.post( "url('category-add-ajax') ?>",{name:$('#name').val()} ,function( data ) { var response = ' Data Saved, Thanks! '; $('.alert').html(response).removeClass('hidden').addClass('alert-success'); + $('#name').val(''); }); } }); diff --git a/module/Category/view/category/index.phtml b/module/Category/view/category/index.phtml index bcfc00e..ba719c0 100644 --- a/module/Category/view/category/index.phtml +++ b/module/Category/view/category/index.phtml @@ -5,13 +5,8 @@
+ Add new Category

+ - "; - // var_dump($categories); - // echo ""; - - ?> @@ -26,9 +21,27 @@
ID View Products Edit - Delete + Delete
+ + +
+ From e4d3e861b2a8674599c3d9e9c7287fb55369f278 Mon Sep 17 00:00:00 2001 From: Mohamed Mahdy Date: Thu, 5 Jul 2018 16:14:01 +0200 Subject: [PATCH 12/18] Show Products List --- module/Product/config/module.config.php | 78 ++++++++++++++--- .../src/Controller/ProductController.php | 85 +++++++++++++++---- .../Controller/ProductControllerFactory.php | 40 +++++++++ module/Product/src/Entity/Product.php | 70 +++++++++++++-- .../src/Repository/ProductRepository.php | 70 +++++++++++++-- module/Product/view/product/add.phtml | 52 ++++++++++++ module/Product/view/product/edit.phtml | 26 ++++++ module/Product/view/product/index.phtml | 67 +++++++-------- themes/default/layout/layout.phtml | 2 +- 9 files changed, 410 insertions(+), 80 deletions(-) create mode 100644 module/Product/src/Controller/ProductControllerFactory.php create mode 100644 module/Product/view/product/add.phtml create mode 100644 module/Product/view/product/edit.phtml diff --git a/module/Product/config/module.config.php b/module/Product/config/module.config.php index 710a1ff..cac2917 100644 --- a/module/Product/config/module.config.php +++ b/module/Product/config/module.config.php @@ -8,22 +8,72 @@ return [ 'router' => [ - 'routes' => [ - 'product' => [ - 'type' => Segment::class, - 'options' => [ - 'route' => '/product/list', - 'defaults' => [ - 'controller' => Controller\ProductController::class, - 'action' => 'index', - ], - ], - ] - ], + 'routes' => [ + 'product-list' => [ + 'type' => Segment::class, + 'options' => [ + 'route' => '/product/list', + 'defaults' => [ + 'controller' => Controller\ProductController::class, + 'action' => 'index', + ], + ], + ], + 'product-add' => [ + 'type' => Segment::class, + 'options' => [ + 'route' => '/product/add', + 'defaults' => [ + 'controller' => Controller\ProductController::class, + 'action' => 'add', + ], + ], + ], + 'product-edit' => [ + 'type' => Segment::class, + 'options' => [ + 'route' => '/product/edit[/:id]', + 'defaults' => [ + 'controller' => Controller\ProductController::class, + 'action' => 'edit', + ], + ], + ], + 'product-add-ajax' => [ + 'type' => Segment::class, + 'options' => [ + 'route' => '/product/post', + 'defaults' => [ + 'controller' => Controller\ProductController::class, + 'action' => 'addAjax', + ], + ], + ], + 'product-edit-ajax' => [ + 'type' => Segment::class, + 'options' => [ + 'route' => '/product/update', + 'defaults' => [ + 'controller' => Controller\ProductController::class, + 'action' => 'updateAjax', + ], + ], + ], + 'product-delete' => [ + 'type' => Segment::class, + 'options' => [ + 'route' => '/product/delete', + 'defaults' => [ + 'controller' => Controller\ProductController::class, + 'action' => 'deleteAjax', + ], + ], + ], + ], ], 'controllers' => [ 'factories' => [ - Controller\ProductController::class => InvokableFactory::class, + Controller\ProductController::class => Controller\ProductControllerFactory::class, ], ], 'view_manager' => [ @@ -35,6 +85,8 @@ 'template_map' => [ 'layout/layout' => __DIR__ . '/../../../themes/default/layout/layout.phtml', 'product/product/index' => __DIR__ . '/../view/product/index.phtml', + 'product/product/add' => __DIR__ . '/../view/product/add.phtml', + 'product/product/edit' => __DIR__ . '/../view/product/edit.phtml', // 'catalog/catalog/add' => __DIR__ . '/../view/catalog/add.phtml', // 'catalog/catalog/edit' => __DIR__ . '/../view/catalog/edit.phtml', 'error/404' => __DIR__ . '/../view/error/404.phtml', diff --git a/module/Product/src/Controller/ProductController.php b/module/Product/src/Controller/ProductController.php index 62d1209..0188876 100644 --- a/module/Product/src/Controller/ProductController.php +++ b/module/Product/src/Controller/ProductController.php @@ -4,25 +4,76 @@ use Zend\Mvc\Controller\AbstractActionController; use Zend\View\Model\ViewModel; +use Doctrine\ORM\EntityManager; use Product\Repository\ProductRepository; +use Category\Repository\CategoryRepository; class ProductController extends AbstractActionController { - public function indexAction() - { - //echo 'ok'; die; - //$products = new Product\src\Repository\ProductRepository(); - //$data = $products->findPublishedProducts(); - return new ViewModel(array('products' => $data)); - } - - public function addAction() - { - return new ViewModel(); - } - - public function editAction() - { - return new ViewModel(); - } + + private $entityManager; + + public function __construct($serviceManager) + { + $this->entityManager = $serviceManager->get(EntityManager::class); + } + + public function indexAction() + { + $products = new ProductRepository($this->entityManager); + $data = $products->findAll(); + return new ViewModel(['products' => $data]); + } + + public function addAction() + { + $categories = new CategoryRepository($this->entityManager); + return new ViewModel(['categories' => $categories->findAll()]); + } + + public function addAjaxAction() + { + if($this->getRequest()->isPost()) { + $product = new ProductRepository($this->entityManager); + // Fill in the form with POST data + $data = $this->params()->fromPost(); + //var_dump($data); die; + $product->create($data); + } + die; + } + + public function editAction() + { + // Get post ID. + $id = (int)$this->params()->fromRoute('id', -1); + $product = new ProductRepository($this->entityManager); + $data = $product->find($id); + + return new ViewModel(['product' => $data]); + } + + public function updateAjaxAction() + { + if($this->getRequest()->isPost()) { + $product = new ProductRepository($this->entityManager); + // Fill in the form with POST data + $data = $this->params()->fromPost(); + $product->update($data); + } + die; + } + + public function deleteAjaxAction() + { + if($this->getRequest()->isPost()) { + $product = new ProductRepository($this->entityManager); + // Fill in the form with POST data + //$id = (int)$this->params()->fromRoute('id', -1); + $data = $this->params()->fromPost(); + $product->delete($data); + } + // echo $id; + die; + } } diff --git a/module/Product/src/Controller/ProductControllerFactory.php b/module/Product/src/Controller/ProductControllerFactory.php new file mode 100644 index 0000000..e10018c --- /dev/null +++ b/module/Product/src/Controller/ProductControllerFactory.php @@ -0,0 +1,40 @@ +get('doctrine.entitymanager.orm_default'); +// var_dump(get_class($entityManager));exit; + // Instantiate the controller and inject dependencies + return new ProductController($container); +// $service = (null === $options) ? new $requestedName : new $requestedName($options); +// return $service->setServiceManager($container); + + } +} diff --git a/module/Product/src/Entity/Product.php b/module/Product/src/Entity/Product.php index 3069149..46eb12f 100644 --- a/module/Product/src/Entity/Product.php +++ b/module/Product/src/Entity/Product.php @@ -8,7 +8,7 @@ * Class Product * @ORM\Entity * @ORM\Table(name="product") - * @package Category\Entity + * @package Product\Entity */ class Product { @@ -18,24 +18,80 @@ class Product * @ORM\GeneratedValue(strategy="AUTO") * @var integer */ - private $id; + public $id; + + /** + * @ORM\Column(type="integer") + * @var integer + */ + public $category_id; /** * @ORM\Column(type="string") * @var string */ - private $title; + public $title; /** - * @ORM\Column(type="text") + * @ORM\Column(type="string") * @var string */ - private $description; + public $price; /** - * @ORM\Column(type="date") + * @ORM\Column(type="text") * @var string */ - private $created; + public $description; + + public function setId($id) + { + $this->id = $id; + } + + public function getId() + { + return $this->id; + } + + public function setCategoryId($category_id) + { + $this->category_id = $category_id; + } + + public function getCategoryId() + { + return $this->category_id; + } + + public function setTitle($title) + { + $this->title = $title; + } + + public function getTitle() + { + return $this->title; + } + + public function setDescription($description) + { + $this->description = $description; + } + + public function getDescription() + { + return $this->description; + } + + public function setPrice($price) + { + $this->price = $price; + } + + public function getPrice() + { + return $this->price; + } } diff --git a/module/Product/src/Repository/ProductRepository.php b/module/Product/src/Repository/ProductRepository.php index dc4995a..8ab1b9e 100644 --- a/module/Product/src/Repository/ProductRepository.php +++ b/module/Product/src/Repository/ProductRepository.php @@ -10,20 +10,74 @@ class ProductRepository extends EntityRepository { - // add - update method - public function findAll(){ + private $entityManager; + public function __construct($entityManager) + { + $this->entityManager = $entityManager; } - // add - update method - public function save(){ + /** + * Retrieves all published posts in descending date order. + * @return Query + */ + public function findAll() + { + $productRepository = $this->entityManager->getRepository(Product::class); + return $productRepository->findAll(); + } - } + public function find($id){ + $row = $this->entityManager->getRepository(Product::class) + ->findOneById($id); + return $row; + } - // delete method - public function delete(){ + public function findObj($id){ + $row = $this->entityManager->getRepository(Product::class)->find($id); + return $row; + } - } + // add method + public function create($data){ + // Create new Post entity. + $product = new Product(); + // $product->name = $data['name']; + $product->setCategoryId($data['category']); + $product->setTitle($data['title']); + $product->setDescription($data['description']); + $product->setprice($data['price']); + + // Add the entity to entity manager. + $this->entityManager->persist($product); + + // Apply changes to database. + $this->entityManager->flush(); + + } + + // update method + public function update($data){ + + $product = new Product(); + $product->setId($data['id']); + $product->setName($data['name']); + + // Add the entity to entity manager. + $this->entityManager->merge($product); + + // Apply changes to database. + $this->entityManager->flush(); + + } + + // delete cateogry method + public function delete($data){ + $product = $this->findObj($data['id']); + $this->entityManager->remove($product); + // Apply changes to database. + $this->entityManager->flush(); + } } diff --git a/module/Product/view/product/add.phtml b/module/Product/view/product/add.phtml new file mode 100644 index 0000000..ac5178f --- /dev/null +++ b/module/Product/view/product/add.phtml @@ -0,0 +1,52 @@ +
+

Manage Products

+
+ +
+ + All Products +
+
+

Add new Product

+ +
+ +
+
+ +
+
+ +
+
+ +
+ +
+
+
+
+
+ diff --git a/module/Product/view/product/edit.phtml b/module/Product/view/product/edit.phtml new file mode 100644 index 0000000..0cfca1a --- /dev/null +++ b/module/Product/view/product/edit.phtml @@ -0,0 +1,26 @@ +
+

Edit Product Information

+
+
+ + All Categories +

+
+ +
+ +
+ +
+
+ diff --git a/module/Product/view/product/index.phtml b/module/Product/view/product/index.phtml index 771d581..18b5093 100644 --- a/module/Product/view/product/index.phtml +++ b/module/Product/view/product/index.phtml @@ -2,49 +2,48 @@

Manage Products

-
- + Add new Product +
+ + Add new Prodct

+ - - - - - - + + + + + - - - - + + + + - - - - - - - - - - - - - - +
IDProduct namedescriptioncreated datecategoryActionIDProduct namepricedescription
1NewsNewsNewsid ?>title ?>price ?>description ?> - Edit - Delete -
2ProductsProductsProducts - Edit - Delete -
3BlogsBlogsBlogs - Edit - Delete + Edit + Delete
+ + +
+ diff --git a/themes/default/layout/layout.phtml b/themes/default/layout/layout.phtml index 88cfd73..c8ec286 100644 --- a/themes/default/layout/layout.phtml +++ b/themes/default/layout/layout.phtml @@ -41,7 +41,7 @@
From fd4fc4a75c96d25deb64b58c686597e4c51a74cf Mon Sep 17 00:00:00 2001 From: Mohamed Mahdy Date: Thu, 5 Jul 2018 16:29:38 +0200 Subject: [PATCH 13/18] add / edit products --- .../src/Controller/ProductController.php | 4 +- .../src/Repository/ProductRepository.php | 7 ++- module/Product/view/product/edit.phtml | 43 ++++++++++++++++--- 3 files changed, 43 insertions(+), 11 deletions(-) diff --git a/module/Product/src/Controller/ProductController.php b/module/Product/src/Controller/ProductController.php index 0188876..5936654 100644 --- a/module/Product/src/Controller/ProductController.php +++ b/module/Product/src/Controller/ProductController.php @@ -49,8 +49,8 @@ public function editAction() $id = (int)$this->params()->fromRoute('id', -1); $product = new ProductRepository($this->entityManager); $data = $product->find($id); - - return new ViewModel(['product' => $data]); + $categories = new CategoryRepository($this->entityManager); + return new ViewModel(['product' => $data,'categories' => $categories->findAll()]); } public function updateAjaxAction() diff --git a/module/Product/src/Repository/ProductRepository.php b/module/Product/src/Repository/ProductRepository.php index 8ab1b9e..a191a5d 100644 --- a/module/Product/src/Repository/ProductRepository.php +++ b/module/Product/src/Repository/ProductRepository.php @@ -61,7 +61,10 @@ public function update($data){ $product = new Product(); $product->setId($data['id']); - $product->setName($data['name']); + $product->setCategoryId($data['category']); + $product->setTitle($data['title']); + $product->setDescription($data['description']); + $product->setprice($data['price']); // Add the entity to entity manager. $this->entityManager->merge($product); @@ -71,7 +74,7 @@ public function update($data){ } - // delete cateogry method + // delete product method public function delete($data){ $product = $this->findObj($data['id']); $this->entityManager->remove($product); diff --git a/module/Product/view/product/edit.phtml b/module/Product/view/product/edit.phtml index 0cfca1a..9b7e9df 100644 --- a/module/Product/view/product/edit.phtml +++ b/module/Product/view/product/edit.phtml @@ -2,14 +2,35 @@

Edit Product Information

- + All Categories + + All Products

- -
- -
- + +
+ +
+
+ +
+
+ +
+
+ +
+ +
+
+