mirror of
https://github.com/danog/Valinor.git
synced 2024-12-11 16:49:51 +01:00
ccf09fd334
This new method can be used for instance in a pipeline during the build and deployment of the application. The cache has to be registered first, otherwise the warmup will end up being useless. ```php $cache = new \CuyZ\Valinor\Cache\FileSystemCache('path/to/cache-dir'); $mapperBuilder = (new \CuyZ\Valinor\MapperBuilder())->withCache($cache); // During the build: $mapperBuilder->warmup(SomeClass::class, SomeOtherClass::class); // In the application: $mapper->mapper()->map(SomeClass::class, [/* … */]); ``` Co-authored-by: Romain Canon <romain.hydrocanon@gmail.com>
22 lines
353 B
PHP
22 lines
353 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace CuyZ\Valinor\Tests\Fixture\Object;
|
|
|
|
// @PHP8.0 implement Stringable
|
|
final class StringableObject
|
|
{
|
|
private string $value;
|
|
|
|
public function __construct(string $value = 'foo')
|
|
{
|
|
$this->value = $value;
|
|
}
|
|
|
|
public function __toString(): string
|
|
{
|
|
return $this->value;
|
|
}
|
|
}
|