Files
iTop/sources/DI/Form/Transformer/DocumentTransformer.php
2023-08-31 15:47:58 +02:00

32 lines
605 B
PHP

<?php
namespace Combodo\iTop\DI\Form\Transformer;
use ormDocument;
use Symfony\Component\Form\DataTransformerInterface;
/**
* Perform transformation between ormDocument and UploadedFile.
*/
class DocumentTransformer implements DataTransformerInterface
{
/** @inheritdoc */
public function transform($value)
{
return null;
}
/** @inheritdoc */
public function reverseTransform($value)
{
if($value === null){
return null;
}
$doc_content = file_get_contents($value->getRealPath());
return new ormDocument($doc_content, $value->getClientMimeType(), $value->getRealPath());
}
}