Skip to content

Commit

Permalink
Fixed capitalization of headings
Browse files Browse the repository at this point in the history
Signed-off-by: matt <[email protected]>
  • Loading branch information
matt committed Oct 24, 2022
1 parent 07336b2 commit 03a5fcb
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions docs/book/v4/strategies/backed-enum.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,27 @@ enum Genre: string
}
```

## Basic usage
## Basic Usage

The following code example shows standalone usage without adding the strategy
to a hydrator.

### Create and configure strategy
### Create and Configure Strategy

Create the strategy passing the class name of the enum it will hydrate and extract:

```php
$strategy = new Laminas\Hydrator\Strategy\BackedEnumStrategy(Genre::class);
```

### Hydrate data
### Hydrate Data

```php
$hydrated = $strategy->hydrate('blues', null);
var_dump($hydrated); // enum Genre::Blues : string("blues");
```

### Extract data
### Extract Data

```php
$extracted = $strategy->extract(Genre::Pop);
Expand Down Expand Up @@ -71,7 +71,7 @@ class Album
}
```

### Create hydrator and add strategy
### Create Hydrator and Add Atrategy

Create a hydrator and add the `BackedEnumStrategy` as a strategy:

Expand All @@ -83,7 +83,7 @@ $hydrator->addStrategy(
);
```

### Hydrate data
### Hydrate Data

Create an instance of the example class and hydrate data:

Expand All @@ -94,7 +94,7 @@ $hydrator->hydrate(['genre' => 'jazz'], $album);
echo $album->getGenre()->value; // "jazz"
```

### Extract data
### Extract Data

```php
$extracted = $hydrator->extract($album);
Expand Down

0 comments on commit 03a5fcb

Please sign in to comment.