murph-core/src/core/Entity/Site/Page/FileBlock.php

26 lines
515 B
PHP
Raw Normal View History

2022-03-13 19:32:32 +01:00
<?php
namespace App\Core\Entity\Site\Page;
use App\Core\File\FileAttribute;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
2022-11-19 19:35:28 +01:00
#[ORM\Entity]
2022-03-13 19:32:32 +01:00
class FileBlock extends Block
{
public function getValue()
{
return FileAttribute::handleFile(parent::getValue());
}
public function setValue($value): self
{
if ($this->getValue() instanceof File && null === $value) {
return $this;
}
return parent::setValue($value);
}
}