Ejemplo n.º 1
0
     * @return string
     */
    public function getValue()
    {
        return $this->value;
    }
}
/**
 * Class Entity
 *
 * @author  Toni Renner <*****@*****.**>
 * @package lithium\EntityService\TestHydrator
 */
class Entity implements RepresentsEntity
{
    /** @var int */
    private $a;
    /** @var \lithium\EntityService\TestHydrator\DataType */
    private $b;
    /** @var \DateTimeImmutable */
    private $c;
}
$hydrator = new Hydrator(Entity::class);
//$hydrator->setCastingBehavior( new Hydrator\Behaviors\PassValuesThrough() );
$start = microtime(true);
for ($i = 0; $i < 50000; $i++) {
    $hydrator->hydrate(['a' => "1", 'b' => "2", 'c' => '2015-09-03']);
}
var_dump(microtime(true) - $start);
// float(4.3119289875031)
print_r($hydrator->hydrate(['a' => "1", 'b' => "2", 'c' => '2015-09-03']));
Ejemplo n.º 2
0
 public function testHydrateOneChildEntityWithCastBehavior()
 {
     $hydrator = new Hydrator(ChildEntity::class);
     $childEntity = $hydrator->hydrate($this->dataForChild);
     $this->assertInstanceOf(ChildEntity::class, $childEntity);
 }