Skip to content
This repository has been archived by the owner on Feb 19, 2025. It is now read-only.

Add getHydrator method to the HydratorFactory #104

Merged
merged 1 commit into from
Oct 14, 2019
Merged

Add getHydrator method to the HydratorFactory #104

merged 1 commit into from
Oct 14, 2019

Conversation

xico42
Copy link

@xico42 xico42 commented Oct 14, 2019

Fix issue #26

Now it is possible to use the HydratorFactory as a real factory:

<?php

use GeneratedHydrator\Configuration;

require_once __DIR__ . '/vendor/autoload.php';

class Example
{
    public    $foo = 1;
    protected $bar = 2;
    protected $baz = 3;
}

$config        = new Configuration('Example');
$hydrator = $config->createFactory()->getHydrator();

var_dump($hydrator->extract($object)); // ['foo' => 1, 'bar' => 2, 'baz' => 3]
$hydrator->hydrate(
    ['foo' => 4, 'bar' => 5, 'baz' => 6],
    $object
);
var_dump($hydrator->extract($object)); // ['foo' => 4, 'bar' => 5, 'baz' => 6]

Copy link
Owner

@Ocramius Ocramius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Ocramius
Copy link
Owner

Failure is CS/unrelated 👍

@Ocramius Ocramius self-assigned this Oct 14, 2019
@Ocramius Ocramius added this to the 3.1.0 milestone Oct 14, 2019
@Ocramius Ocramius merged commit 5a479e7 into Ocramius:master Oct 14, 2019
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.

2 participants