From d594cc3b227bfcfd0f85094e382afcf2245a4ce3 Mon Sep 17 00:00:00 2001 From: George Steel Date: Fri, 14 Jan 2022 11:49:33 +0000 Subject: [PATCH 01/11] Initial work on a migration guide for 3 Signed-off-by: George Steel --- docs/book/migrating.md | 36 ++++++++++++++++++++++++++++++++++++ mkdocs.yml | 2 ++ 2 files changed, 38 insertions(+) create mode 100644 docs/book/migrating.md diff --git a/docs/book/migrating.md b/docs/book/migrating.md new file mode 100644 index 000000000..1889d9e13 --- /dev/null +++ b/docs/book/migrating.md @@ -0,0 +1,36 @@ +# Migration Guide + +Version 3 is the first major release of `laminas-view` and includes a number of backwards incompatible changes. + +## Helper Removals + +### Flash Messenger + +The flash messenger view helper is no longer present in version 3 and has been migrated to a separate package: [laminas-mvc-plugin-flashmessenger](https://github.com/laminas/laminas-mvc-plugin-flashmessenger). In order to continue to use the flash messenger in your projects, you will need to explicitly require it in your composer dependencies. + +### Obsolete View Helpers: Flash and Quicktime + +The deprecated helpers `htmlFlash` and `htmlQuicktime` have been removed. If your project requires these helpers, you can make use of the [HtmlObject](helpers/html-object.md) view helper to achieve the same output. + +```php +echo $this->htmlObject( + 'path/to/flash.swf', + 'application/x-shockwave-flash', + [ + 'width' => 640, + 'height' => 480, + 'id' => 'long-live-flash' + ], + [ + 'movie' => 'path/to/flash.swf', + 'quality' => 'high' + ], + 'Fallback Text Content' +); +``` + +## Backwards Incompatible Changes to Helpers + +### Json View Helper + +In previous versions of laminas-view the [Json View Helper](helpers/json.md) made use of the [laminas-json](https://github.com/laminas/laminas-json) library which enabled encoding of [JSON Expressions](https://github.com/laminas/laminas-json/blob/3.4.x/docs/book/advanced.md#json-expressions). Support for this library and the expression finder feature has been removed. diff --git a/mkdocs.yml b/mkdocs.yml index c8d4e4643..24315a0bd 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -15,6 +15,7 @@ nav: - Cycle: v2/helpers/cycle.md - Doctype: v2/helpers/doctype.md - Escape: v2/helpers/escape.md + - FlashMessenger: v2/helpers/flash-messenger.md - Gravatar: v2/helpers/gravatar.md - HeadLink: v2/helpers/head-link.md - HeadMeta: v2/helpers/head-meta.md @@ -41,6 +42,7 @@ nav: - "Preparing for Version 3": v2/migration/preparing-for-v3.md - v3: - "Quick Start": v3/quick-start.md + - "Migrating from v2 to v3": migrating.md - "Rendering Views": - "The PhpRenderer": v3/php-renderer.md - "View Scripts": v3/view-scripts.md From ee947818281998d43c03cc552bfb03b75313b4f7 Mon Sep 17 00:00:00 2001 From: George Steel Date: Fri, 14 Jan 2022 13:05:29 +0000 Subject: [PATCH 02/11] Explicit title for applicable versions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Frank Brückner Signed-off-by: George Steel --- docs/book/migrating.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/book/migrating.md b/docs/book/migrating.md index 1889d9e13..578671dda 100644 --- a/docs/book/migrating.md +++ b/docs/book/migrating.md @@ -1,4 +1,4 @@ -# Migration Guide +# Migration from Version 2 to 3 Version 3 is the first major release of `laminas-view` and includes a number of backwards incompatible changes. From 054b7ffda76c6536b79b5ad5eccd769870e6e4be Mon Sep 17 00:00:00 2001 From: George Steel Date: Fri, 14 Jan 2022 13:09:43 +0000 Subject: [PATCH 03/11] Relocate migration guide and move to the end of the navigation Signed-off-by: George Steel --- docs/book/{migrating.md => v3/migration/v2-to-v3.md} | 0 mkdocs.yml | 3 ++- 2 files changed, 2 insertions(+), 1 deletion(-) rename docs/book/{migrating.md => v3/migration/v2-to-v3.md} (100%) diff --git a/docs/book/migrating.md b/docs/book/v3/migration/v2-to-v3.md similarity index 100% rename from docs/book/migrating.md rename to docs/book/v3/migration/v2-to-v3.md diff --git a/mkdocs.yml b/mkdocs.yml index 24315a0bd..d0f255355 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -42,7 +42,6 @@ nav: - "Preparing for Version 3": v2/migration/preparing-for-v3.md - v3: - "Quick Start": v3/quick-start.md - - "Migrating from v2 to v3": migrating.md - "Rendering Views": - "The PhpRenderer": v3/php-renderer.md - "View Scripts": v3/view-scripts.md @@ -76,6 +75,8 @@ nav: - 'Stand-Alone': v3/application-integration/stand-alone.md - Cookbook: - "Setting module-specific Layouts": v3/cookbook/setting-module-specific-layouts.md + - Migration: + - "Migration from Version 2 to 3": v3/migration/v2-to-v3.md site_name: laminas-view site_description: 'Flexible view layer supporting and providing multiple view layers, helpers, and more.' repo_url: 'https://github.com/laminas/laminas-view' From 62132e33d688b9a56df715b5f4fb6ca20fa767b6 Mon Sep 17 00:00:00 2001 From: George Steel Date: Fri, 14 Jan 2022 13:18:55 +0000 Subject: [PATCH 04/11] Reformat content and add outline headings Signed-off-by: George Steel --- docs/book/v3/migration/v2-to-v3.md | 35 ++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/docs/book/v3/migration/v2-to-v3.md b/docs/book/v3/migration/v2-to-v3.md index 578671dda..6cb717054 100644 --- a/docs/book/v3/migration/v2-to-v3.md +++ b/docs/book/v3/migration/v2-to-v3.md @@ -2,15 +2,34 @@ Version 3 is the first major release of `laminas-view` and includes a number of backwards incompatible changes. -## Helper Removals +## New Features -### Flash Messenger +## New Dependencies -The flash messenger view helper is no longer present in version 3 and has been migrated to a separate package: [laminas-mvc-plugin-flashmessenger](https://github.com/laminas/laminas-mvc-plugin-flashmessenger). In order to continue to use the flash messenger in your projects, you will need to explicitly require it in your composer dependencies. +## Signature Changes and Behaviour Changes -### Obsolete View Helpers: Flash and Quicktime +## Removed Features -The deprecated helpers `htmlFlash` and `htmlQuicktime` have been removed. If your project requires these helpers, you can make use of the [HtmlObject](helpers/html-object.md) view helper to achieve the same output. +### Helpers + +#### Json View Helper + +In previous versions of laminas-view the [Json View Helper](helpers/json.md) made use of the [laminas-json](https://docs.laminas.dev/laminas-json/) library which enabled encoding of [JSON Expressions](https://docs.laminas.dev/laminas-json/advanced/#json-expressions). +Support for this library and the expression finder feature has been removed. + +## Removed Class and Traits + +### Removed Helpers + +#### Flash Messenger + +The flash messenger view helper is no longer present in version 3 and has been migrated to a separate package: [laminas-mvc-plugin-flashmessenger](https://docs.laminas.dev/laminas-mvc-plugin-flashmessenger/). +In order to continue to use the flash messenger in your projects, you will need to explicitly require it in your composer dependencies. + +#### Flash and Quicktime + +The deprecated helpers `htmlFlash` and `htmlQuicktime` have been removed. +If your project requires these helpers, you can make use of the [HtmlObject](helpers/html-object.md) view helper to achieve the same output. ```php echo $this->htmlObject( @@ -28,9 +47,3 @@ echo $this->htmlObject( 'Fallback Text Content' ); ``` - -## Backwards Incompatible Changes to Helpers - -### Json View Helper - -In previous versions of laminas-view the [Json View Helper](helpers/json.md) made use of the [laminas-json](https://github.com/laminas/laminas-json) library which enabled encoding of [JSON Expressions](https://github.com/laminas/laminas-json/blob/3.4.x/docs/book/advanced.md#json-expressions). Support for this library and the expression finder feature has been removed. From 9ede37f7b2a7237b62bc1ec25deb569767c6a848 Mon Sep 17 00:00:00 2001 From: George Steel Date: Tue, 1 Feb 2022 15:33:37 +0000 Subject: [PATCH 05/11] Document removal of stream wrappers Signed-off-by: George Steel --- docs/book/v3/migration/v2-to-v3.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/book/v3/migration/v2-to-v3.md b/docs/book/v3/migration/v2-to-v3.md index 6cb717054..970c8eb73 100644 --- a/docs/book/v3/migration/v2-to-v3.md +++ b/docs/book/v3/migration/v2-to-v3.md @@ -10,6 +10,12 @@ Version 3 is the first major release of `laminas-view` and includes a number of ## Removed Features +### Stream Wrapper Functionality + +In previous versions of laminas-view, it was possible to enable stream wrapper functionality in order to work around an inability to enable PHP's `short_open_tag` ini setting. +This functionality has been removed in version 3. +If you had not explicitly enabled this feature, this change will not affect your code. + ### Helpers #### Json View Helper From 6e92a88f8936103af4db1c6c62d1539fb32ed560 Mon Sep 17 00:00:00 2001 From: George Steel Date: Mon, 14 Feb 2022 10:12:39 +0000 Subject: [PATCH 06/11] Adds escape helper method removals Signed-off-by: George Steel --- docs/book/v3/migration/v2-to-v3.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/book/v3/migration/v2-to-v3.md b/docs/book/v3/migration/v2-to-v3.md index 970c8eb73..ef84af161 100644 --- a/docs/book/v3/migration/v2-to-v3.md +++ b/docs/book/v3/migration/v2-to-v3.md @@ -18,6 +18,12 @@ If you had not explicitly enabled this feature, this change will not affect your ### Helpers +#### Escape Helpers: `escapeCss`, `escapeHtml`, `escapeHtmlAttr`, `escapeJs`, and `escapeUrl` + +The methods `setEncoding()`, `getEncoding()`, `setView()`, `getView()`, `setEscaper()`, and `getEscaper()` have been removed from the escape helpers. These helpers now have constructors that expect an [Escaper](https://docs.laminas.dev/laminas-escaper/) instance that has been configured with the encoding you expect to output in your view. + +The encoding defaults to UTF-8 as it has always done but can be overridden in configuration by setting `view_manager.encoding` to your preferred value. + #### Json View Helper In previous versions of laminas-view the [Json View Helper](helpers/json.md) made use of the [laminas-json](https://docs.laminas.dev/laminas-json/) library which enabled encoding of [JSON Expressions](https://docs.laminas.dev/laminas-json/advanced/#json-expressions). From e07020907fb5d995979880c8787a8d9f63a3cbc8 Mon Sep 17 00:00:00 2001 From: George Steel Date: Thu, 24 Mar 2022 14:54:51 +0000 Subject: [PATCH 07/11] Adds information about the gravatar helper replacement Signed-off-by: George Steel --- docs/book/v3/migration/v2-to-v3.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/book/v3/migration/v2-to-v3.md b/docs/book/v3/migration/v2-to-v3.md index ef84af161..01d3e40c2 100644 --- a/docs/book/v3/migration/v2-to-v3.md +++ b/docs/book/v3/migration/v2-to-v3.md @@ -59,3 +59,17 @@ echo $this->htmlObject( 'Fallback Text Content' ); ``` + +#### Gravatar + +The deprecated Gravatar view helper has been removed and replaced with a simplified version that doesn't store any state. The replacement helper is called [GravatarImage](helpers/gravatar-image.md) and has the following signature when accessed via view scripts: + +```php +function gravatarImage( + string $email, + int $imageSize = 80, + array $imageAttributes = [], + string $defaultImage = 'mm', + string $rating = 'g' +); +``` From eab94756ce91b1e0509c0503b66d0430f7aec769 Mon Sep 17 00:00:00 2001 From: George Steel Date: Thu, 24 Mar 2022 15:03:15 +0000 Subject: [PATCH 08/11] Document removal of laminas console integration Signed-off-by: George Steel --- docs/book/v3/migration/v2-to-v3.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/book/v3/migration/v2-to-v3.md b/docs/book/v3/migration/v2-to-v3.md index 01d3e40c2..e3eb2a6c7 100644 --- a/docs/book/v3/migration/v2-to-v3.md +++ b/docs/book/v3/migration/v2-to-v3.md @@ -16,6 +16,10 @@ In previous versions of laminas-view, it was possible to enable stream wrapper f This functionality has been removed in version 3. If you had not explicitly enabled this feature, this change will not affect your code. +### Laminas Console Integration + +`Laminas\View\RendererConsoleRenderer` and `Laminas\View\Model\ConsoleModel` have been removed effectively removing all support for the deprecated `laminas-console` component. + ### Helpers #### Escape Helpers: `escapeCss`, `escapeHtml`, `escapeHtmlAttr`, `escapeJs`, and `escapeUrl` From c6e9ab0f73aaa9ec863ce684c197e895fb8d329b Mon Sep 17 00:00:00 2001 From: George Steel Date: Thu, 24 Mar 2022 15:21:17 +0000 Subject: [PATCH 09/11] Document changes to the asset helper and reformat with one sentence per line Signed-off-by: George Steel --- docs/book/v3/migration/v2-to-v3.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/book/v3/migration/v2-to-v3.md b/docs/book/v3/migration/v2-to-v3.md index e3eb2a6c7..66a85a264 100644 --- a/docs/book/v3/migration/v2-to-v3.md +++ b/docs/book/v3/migration/v2-to-v3.md @@ -8,6 +8,15 @@ Version 3 is the first major release of `laminas-view` and includes a number of ## Signature Changes and Behaviour Changes +### Helpers + +#### Asset Helper + +Previous versions of the asset helper permitted run-time modification and retrieval of the resource map with `Laminas\View\Helper\Asset::setResourceMap()` and `Laminas\View\Helper\Asset::getResourceMap()`. +Both of these methods have been removed. +Now, the only way to configure the resource map is via constructor injection. +The method of configuring the resource map remains unchanged. + ## Removed Features ### Stream Wrapper Functionality @@ -24,7 +33,8 @@ If you had not explicitly enabled this feature, this change will not affect your #### Escape Helpers: `escapeCss`, `escapeHtml`, `escapeHtmlAttr`, `escapeJs`, and `escapeUrl` -The methods `setEncoding()`, `getEncoding()`, `setView()`, `getView()`, `setEscaper()`, and `getEscaper()` have been removed from the escape helpers. These helpers now have constructors that expect an [Escaper](https://docs.laminas.dev/laminas-escaper/) instance that has been configured with the encoding you expect to output in your view. +The methods `setEncoding()`, `getEncoding()`, `setView()`, `getView()`, `setEscaper()`, and `getEscaper()` have been removed from the escape helpers. +These helpers now have constructors that expect an [Escaper](https://docs.laminas.dev/laminas-escaper/) instance that has been configured with the encoding you expect to output in your view. The encoding defaults to UTF-8 as it has always done but can be overridden in configuration by setting `view_manager.encoding` to your preferred value. @@ -66,7 +76,8 @@ echo $this->htmlObject( #### Gravatar -The deprecated Gravatar view helper has been removed and replaced with a simplified version that doesn't store any state. The replacement helper is called [GravatarImage](helpers/gravatar-image.md) and has the following signature when accessed via view scripts: +The deprecated Gravatar view helper has been removed and replaced with a simplified version that doesn't store any state. +The replacement helper is called [GravatarImage](helpers/gravatar-image.md) and has the following signature when accessed via view scripts: ```php function gravatarImage( From f1066f6f77a4d774420815883c2931fff633c49f Mon Sep 17 00:00:00 2001 From: George Steel Date: Thu, 24 Mar 2022 15:38:42 +0000 Subject: [PATCH 10/11] Document changes to the identity helper Signed-off-by: George Steel --- docs/book/v3/migration/v2-to-v3.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/book/v3/migration/v2-to-v3.md b/docs/book/v3/migration/v2-to-v3.md index 66a85a264..349860cd3 100644 --- a/docs/book/v3/migration/v2-to-v3.md +++ b/docs/book/v3/migration/v2-to-v3.md @@ -17,6 +17,11 @@ Both of these methods have been removed. Now, the only way to configure the resource map is via constructor injection. The method of configuring the resource map remains unchanged. +#### Identity Helper + +The deprecated runtime retrieval and modification of the underlying authentication service has been removed and the service must be injected into the helper constructor. +Specifically, the methods `Laminas\View\Helper\Identity::setAuthenticationService()` and `Laminas\View\Helper\Identity::getAuthenticationService()` have been removed. + ## Removed Features ### Stream Wrapper Functionality From 886d5808d4412043030b29c9d30f07ab3ab95488 Mon Sep 17 00:00:00 2001 From: George Steel Date: Thu, 24 Mar 2022 15:42:19 +0000 Subject: [PATCH 11/11] Add general note about removal of Zend aliases and service names Signed-off-by: George Steel --- docs/book/v3/migration/v2-to-v3.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/book/v3/migration/v2-to-v3.md b/docs/book/v3/migration/v2-to-v3.md index 349860cd3..25b17c54f 100644 --- a/docs/book/v3/migration/v2-to-v3.md +++ b/docs/book/v3/migration/v2-to-v3.md @@ -8,6 +8,11 @@ Version 3 is the first major release of `laminas-view` and includes a number of ## Signature Changes and Behaviour Changes +### Legacy Zend-Related Service and Helper Names + +All helper aliases that referred to the `Zend` equivalent of a helper or service have been removed. +Similarly, factories that previously searched for services in the container such as a Translator or Authentication Service for example, no longer check for the presence of the Zend equivalent. + ### Helpers #### Asset Helper