Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Serialize into array #219

Merged
merged 11 commits into from
Apr 6, 2017

Conversation

snapshotpl
Copy link
Contributor

For me it's useful when I want to serialize messages to log using psr-4 (into context)

@snapshotpl snapshotpl changed the base branch from master to develop December 28, 2016 17:00
@snapshotpl
Copy link
Contributor Author

If it ok I will make serializer for response. What are you think about deserializers from arrays?

@Ocramius
Copy link
Member

@snapshotpl would segregate it to a separate serializer or interface (implementation can be added to existing one, but ISP must be respected IMO)

@snapshotpl
Copy link
Contributor Author

@Ocramius as it's static method interface doesn't sense here imo.

@Ocramius
Copy link
Member

Ocramius commented Dec 29, 2016 via email

@snapshotpl
Copy link
Contributor Author

What about array deserializer idea?

@weierophinney
Copy link
Member

I would create Zend\Diactoros\Request\ArraySerializer and Zend\Diactoros\Response\ArraySerializer classes, each with the methods:

  • fromArray(array $messageData)
  • toArray(RequestInterface $request)

The purpose of the current serializers is specifically for string de/serialization, and the methods exposed reflect that purpose. New classes specifically for array de/serialization make sense here.

@snapshotpl snapshotpl changed the title Serialize into array [WIP] Serialize into array Jan 4, 2017
@snapshotpl snapshotpl changed the title [WIP] Serialize into array Serialize into array Mar 4, 2017
@snapshotpl
Copy link
Contributor Author

@weierophinney @Ocramius ready to review

@weierophinney weierophinney added this to the 1.4.0 milestone Apr 6, 2017
@weierophinney weierophinney merged commit 48f2f2b into zendframework:develop Apr 6, 2017
weierophinney added a commit that referenced this pull request Apr 6, 2017
weierophinney added a commit that referenced this pull request Apr 6, 2017
weierophinney added a commit that referenced this pull request Apr 6, 2017
@weierophinney
Copy link
Member

Merged to develop for release with 1.4.0; thanks, @snapshotpl

@weierophinney weierophinney self-assigned this Apr 6, 2017
jesseschalken added a commit to ivt/zend-diactoros that referenced this pull request May 15, 2017
zend-diactoros 1.4.0

Added
-----

- [zendframework#219](zendframework#219) adds two new
  classes, `Zend\Diactoros\Request\ArraySerializer` and
  `Zend\Diactoros\Response\ArraySerializer`. Each exposes the static methods
  `toArray()` and `fromArray()`, allowing de/serialization of messages from and
  to arrays.

- [zendframework#236](zendframework#236) adds two new
  constants to the `Response` class: `MIN_STATUS_CODE_VALUE` and
  `MAX_STATUS_CODE_VALUE`.

Changes
-------

- [zendframework#240](zendframework#240) changes the
  behavior of `ServerRequestFactory::fromGlobals()` when no `$cookies` argument
  is present. Previously, it would use `$_COOKIES`; now, if a `Cookie` header is
  present, it will parse and use that to populate the instance instead.

  This change allows utilizing cookies that contain period characters (`.`) in
  their names (PHP's built-in cookie handling renames these to replace `.` with
  `_`, which can lead to synchronization issues with clients).

- [zendframework#235](zendframework#235) changes the
  behavior of `Uri::__toString()` to better follow proscribed behavior in PSR-7.
  In particular, prior to this release, if a scheme was missing but an authority
  was present, the class was incorrectly returning a value that did not include
  a `//` prefix. As of this release, it now does this correctly.

Deprecated
----------

- Nothing.

Removed
-------

- Nothing.

Fixed
-----

- Nothing.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants