<?php
require_once 'Hydrator.php';
/**
* Example object
*/
class UserEntity
{
/** @var string */
private $firstName;
/** @var string */
private $lastName;
/** @var string */
public function getDisplayName()
{
return "{$this->firstName} {$this->lastName}";
}
}
$user = Hydrator::hydrate(new UserEntity(), [
'first_name' => 'John',
'last_name' => 'Smith',
]);
var_dump($user->getDisplayName());
|