Skip to content

Commit

Permalink
Merge pull request #238 from gsteel/json-view-helper-v3
Browse files Browse the repository at this point in the history
[v3] Remove the Json view helper and update the migration guide
  • Loading branch information
gsteel authored Mar 7, 2024
2 parents 18086e8 + d202ab9 commit ab2c6f9
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 165 deletions.
2 changes: 1 addition & 1 deletion docs/book/v2/migration/preparing-for-v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ try {
}
```

## Deprecations
## Deprecations

### Undocumented Behaviour

Expand Down
21 changes: 0 additions & 21 deletions docs/book/v3/helpers/json.md

This file was deleted.

13 changes: 8 additions & 5 deletions docs/book/v3/migration/v2-to-v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ These helpers now have constructors that expect an [Escaper](https://docs.lamina

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).
Support for this library and the expression finder feature has been removed.

## Removed Class and Traits

### Removed Helpers
Expand Down Expand Up @@ -98,3 +93,11 @@ function gravatarImage(
string $rating = 'g'
);
```

#### Json

The deprecated Json view helper has been removed.
To encode data to Json for output in a view, you can call [`json_encode`](https://www.php.net/json_encode) directly.

If you were relying on behaviour that was previously available via `laminas-json`, for example, calling object methods `toArray` or `toJson` prior to encoding, you should make the relevant objects implement `JsonSerializable`.
You can find documentation on the `JsonSerializable` interface [on the PHP website](https://www.php.net/manual/class.jsonserializable.php).
2 changes: 0 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ nav:
- HtmlTag: v3/helpers/html-tag.md
- Identity: v3/helpers/identity.md
- InlineScript: v3/helpers/inline-script.md
- Json: v3/helpers/json.md
- Layout: v3/helpers/layout.md
- Partial: v3/helpers/partial.md
- Placeholder: v3/helpers/placeholder.md
Expand Down Expand Up @@ -115,7 +114,6 @@ plugins:
helpers/html-tag.md: v3/helpers/html-tag.md
helpers/identity.md: v3/helpers/identity.md
helpers/inline-script.md: v3/helpers/inline-script.md
helpers/json.md: v3/helpers/json.md
helpers/layout.md: v3/helpers/layout.md
helpers/partial.md: v3/helpers/partial.md
helpers/placeholder.md: v3/helpers/placeholder.md
Expand Down
75 changes: 0 additions & 75 deletions src/Helper/Json.php

This file was deleted.

4 changes: 0 additions & 4 deletions src/HelperPluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ class HelperPluginManager extends AbstractPluginManager
'inlinescript' => Helper\InlineScript::class,
'inlineScript' => Helper\InlineScript::class,
'InlineScript' => Helper\InlineScript::class,
'json' => Helper\Json::class,
'Json' => Helper\Json::class,
'layout' => Helper\Layout::class,
'Layout' => Helper\Layout::class,
'paginationcontrol' => Helper\PaginationControl::class,
Expand Down Expand Up @@ -181,7 +179,6 @@ class HelperPluginManager extends AbstractPluginManager
Helper\HtmlObject::class => InvokableFactory::class,
Helper\HtmlPage::class => InvokableFactory::class,
Helper\InlineScript::class => InvokableFactory::class,
Helper\Json::class => InvokableFactory::class,
Helper\Layout::class => InvokableFactory::class,
Helper\PaginationControl::class => InvokableFactory::class,
Helper\PartialLoop::class => InvokableFactory::class,
Expand Down Expand Up @@ -217,7 +214,6 @@ class HelperPluginManager extends AbstractPluginManager
'laminasviewhelperhtmlobject' => InvokableFactory::class,
'laminasviewhelperhtmlpage' => InvokableFactory::class,
'laminasviewhelperinlinescript' => InvokableFactory::class,
'laminasviewhelperjson' => InvokableFactory::class,
'laminasviewhelperlayout' => InvokableFactory::class,
'laminasviewhelperpaginationcontrol' => InvokableFactory::class,
'laminasviewhelperpartialloop' => InvokableFactory::class,
Expand Down
1 change: 0 additions & 1 deletion src/Renderer/PhpRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
* @method string htmlPage($data, array $attribs = array(), array $params = array(), $content = null)
* @method mixed|null identity()
* @method \Laminas\View\Helper\InlineScript inlineScript($mode = \Laminas\View\Helper\HeadScript::FILE, $spec = null, $placement = 'APPEND', array $attrs = array(), $type = 'text/javascript')
* @method string|void json($data, array $jsonOptions = array())
* @method \Laminas\View\Helper\Layout layout($template = null)
* @method \Laminas\View\Helper\Navigation navigation($container = null)
* @method string paginationControl(\Laminas\Paginator\Paginator $paginator = null, $scrollingStyle = null, $partial = null, $params = null)
Expand Down
56 changes: 0 additions & 56 deletions test/Helper/JsonTest.php

This file was deleted.

0 comments on commit ab2c6f9

Please sign in to comment.