for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Silverback API Components Bundle Project
*
* (c) Daniel West <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Silverback\ApiComponentsBundle\Entity\Component;
use ApiPlatform\Core\Annotation\ApiProperty;
use Doctrine\ORM\Mapping as ORM;
use Silverback\ApiComponentsBundle\Annotation as Silverback;
use Silverback\ApiComponentsBundle\Dto\FormView;
use Silverback\ApiComponentsBundle\Entity\Core\AbstractComponent;
use Silverback\ApiComponentsBundle\Entity\Utility\TimestampedTrait;
use Silverback\ApiComponentsBundle\Validator\Constraints as ACBAssert;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\Mapping\ClassMetadata;
/**
* @author Daniel West <[email protected]>
* @Silverback\Timestamped
* @ORM\Entity
class Form extends AbstractComponent
{
use TimestampedTrait;
* @ORM\Column(nullable=false)
public string $formType;
/** @ApiProperty(writable=false) */
public ?FormView $formView = null;
public static function loadValidatorMetadata(ClassMetadata $metadata): void
$metadata->addPropertyConstraints(
'formType',
[
new Assert\NotBlank(),
new ACBAssert\FormTypeClass(),
]
);
}