for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Silverback\ApiComponentBundle\Entity\Content;
use ApiPlatform\Core\Annotation\ApiProperty;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* Trait FileTrait
* @package Silverback\ApiComponentBundle\Entity\Content\Component
*/
trait FileTrait
{
* We are not asserting this is a file here because it may be a string for dynamic component e.g. {{ filePath }}
* validation constraint could be made perhaps to validate a file or a variable
* @ORM\Column(type="string", nullable=false)
* @Groups({"component", "content"})
* @ApiProperty(iri="http://schema.org/contentUrl")
* @var null|string
protected $filePath;
* @return null|string
public function getFilePath(): ?string
return $this->filePath;
}
* @param null|string $filePath
public function setFilePath(?string $filePath): void
$this->filePath = $filePath;
public static function getImagineFilters(): array
return [
'thumbnail' => 'thumbnail',
'placeholderSquare' => 'placeholder_square',
'placeholder' => 'placeholder'
];
public function getDir(): ?string
return null;