Skip to content

Commit

Permalink
readme updates
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikbjorn committed Mar 1, 2014
1 parent 4e7e9d6 commit d1f865c
Showing 1 changed file with 6 additions and 21 deletions.
27 changes: 6 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,20 @@ Normalt
Normalt is a extension to Symfony Serializer than implements only the Normalization part. It comes with several
different Normalizers that can be used to normalize from object to array and denormalize from array to object.

The main interaction is the Marshaller. This is a implementation of `DenormalizerInterface` and `NormalizerInterface`.

Getting Started
---------------

Each normalizer can be used on its own, but you can also use a `NormalizerSet` to use many different dependent on
the type you are normalizing, just like when using the serializer.

``` php
use Normalt\NormalizerSet;
use Normalt\Marshaller;
use Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer;
use Symfony\Component\Serializer\Normalizer\CustomNormalizer;

$set = new NormalizerSet(array(
$set = new Marshaller(array(
new GetSetMethodNormalizer,
new CustomNormalizer,
));
Expand All @@ -26,8 +28,8 @@ $normalized = $set->normalize(new MyObject);
$object = $set->denormalize($normalized);
```

Any normalizer that is used through the `NormalizerSet` will have an instance of it set
if they implement `Normalt\NormalizerAware`. Same as if you have a Normalizer that implements
Any normalizer that is used through the `Marshaller` will have an instance of it set
if they implement `Normalt\MarshallerAware`. Same as if you have a Normalizer that implements
`SerializerAwareInterface` and use the Serializer.

RecursiveReflectionNormalizer
Expand Down Expand Up @@ -65,20 +67,3 @@ class MyModelWrapper {

$normalizer->normalize(new MyModelWrapper);
```

Naming Suggestions
------------------

Because Normalizer is used in the Serializer and the PropertyNormalizer concepts it is very easy to get
confused. So here is some suggestion for renaming the NormalizerSet.

### Marshal

> ...marshalling (sometimes spelled marshaling) is the process of transforming the memory representation of an
> object to a data format suitable for storage or transmission, and it is typically used when data must be
> moved between different parts of a computer program...
seems like the concept match up to what we are doing here, if we look at array as a suitable representation
for storage.

This would name the NormalizerSet `Marshaller` (like in Java) and leave the PropertyNormalizer be.

0 comments on commit d1f865c

Please sign in to comment.