mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-27 20:48:46 +02:00
poc form SDK (extends to form)
This commit is contained in:
31
sources/DI/Form/Transformer/DocumentTransformer.php
Normal file
31
sources/DI/Form/Transformer/DocumentTransformer.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?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());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user