Skip to content

Commit

Permalink
Fix up errors in the code examples
Browse files Browse the repository at this point in the history
Signed-off-by: Matthew Setter <[email protected]>
  • Loading branch information
settermjd authored and weierophinney committed Oct 6, 2020
1 parent 919d47f commit aa106c9
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions docs/book/v3/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ use Laminas\Hydrator;

class User
{
private string $firstName;
private string $lastName;
private string $emailAddress;
private string $phoneNumber;
private $firstName;
private $lastName;
private $emailAddress;
private $phoneNumber;

public function setFirstName(string $firstName) {
$this->firstName = $firstName;
Expand All @@ -91,8 +91,8 @@ $data = [
];

$hydrator = new Hydrator\ClassMethodsHydrator();
$user = $delegating->hydrate($data, new User());
$data = $delegating->extract(new User());
$user = $hydrator->hydrate($data, new User());
$data = $hydrator->extract(new User());
```

### ObjectPropertyHydrator
Expand All @@ -106,10 +106,10 @@ use Laminas\Hydrator;

class User
{
public string $firstName;
public string $lastName;
public string $emailAddress;
public string $phoneNumber;
private $firstName;
private $lastName;
private $emailAddress;
private $phoneNumber;
}

$data = [
Expand All @@ -120,8 +120,8 @@ $data = [
];

$hydrator = new Hydrator\ObjectPropertyHydrator();
$user = $delegating->hydrate($data, new User());
$data = $delegating->extract(new User());
$user = $hydrator->hydrate($data, new User());
$data = $hydrator->extract(new User());
```

### ReflectionHydrator
Expand All @@ -137,10 +137,10 @@ use Laminas\Hydrator;

class User
{
private string $firstName;
private string $lastName;
private string $emailAddress;
private string $phoneNumber;
private $firstName;
private $lastName;
private $emailAddress;
private $phoneNumber;
}

$data = [
Expand All @@ -151,8 +151,8 @@ $data = [
];

$hydrator = new Hydrator\ReflectionHydrator();
$user = $delegating->hydrate($data, new User());
$data = $delegating->extract(new User());
$user = $hydrator->hydrate($data, new User());
$data = $hydrator->extract(new User());
```

### DelegatingHydrator
Expand All @@ -176,6 +176,7 @@ $hydrators->setService('Artist', $artistHydrator);
$delegating = new Laminas\Hydrator\DelegatingHydrator($hydrators);

// Now we can use $delegating to hydrate or extract any supported object
// Assumes that $data and Artist have already been initialised
$array = $delegating->extract(new Artist());
$artist = $delegating->hydrate($data, new Artist());
```
Expand Down

0 comments on commit aa106c9

Please sign in to comment.