<?phpnamespace App\AtechNet\CoreBundle\Entity;use Doctrine\ORM\Mapping\Column;use Doctrine\ORM\Mapping\Entity;use Doctrine\ORM\Mapping\HasLifecycleCallbacks;use Doctrine\ORM\Mapping\JoinColumn;use Doctrine\ORM\Mapping\ManyToOne;use App\AtechNet\CoreBundle\Enum\UnitList;use Doctrine\ORM\Mapping\Table as Table;use Symfony\Component\Validator\Constraints as Assert;/** * ProductModelConfigFieldValue * * @Table(name="product_model_config_field_values") * @Entity * @HasLifecycleCallbacks */class ProductModelConfigFieldValue extends AbstractSignedEntity{ /** * @var ProductModel * * @ManyToOne(targetEntity="ProductModel", inversedBy="productModelConfigFieldValues") * @JoinColumn(name="product_model_id", referencedColumnName="id") */ private ProductModel $productModel; /** * @var V2Attribute * * @Assert\NotNull * * @ManyToOne(targetEntity="V2Attribute", inversedBy="additionalFields") * @JoinColumn(name="v2_attribute_id", referencedColumnName="id") */ private $v2Attribute; /** * @var string * * @Assert\NotNull * * @Column(name="field_value", type="text") */ private $fieldValue; /** * @var int * * @Column(name="unit", type="integer", nullable=true) */ private $fieldValueUnit; /** * @return ProductModel */ public function getProductModel(): ProductModel { return $this->productModel; } /** * @param ProductModel $productModel */ public function setProductModel(ProductModel $productModel): void { $this->productModel = $productModel; } /** * @return V2Attribute */ public function getV2Attribute() { return $this->v2Attribute; } /** * @param V2Attribute $vV2Attribute */ public function setV2Attribute(V2Attribute $v2Attribute) { $this->v2Attribute = $v2Attribute; } /** * @return string */ public function getFieldValue() { return $this->fieldValue; } /** * @param string $fieldValue */ public function setFieldValue(string $fieldValue) { $this->fieldValue = $fieldValue; } /** * @return string[] */ public static function getUnitList(): array { return UnitList::getChoices(); } /** * @return UnitList|null */ public function getUnit(): ?UnitList { return $this->fieldValueUnit ? UnitList::from($this->fieldValueUnit) : null; } /** * @param UnitList|null */ public function setUnit(?UnitList $fieldValueUnit) { $this->fieldValueUnit = $fieldValueUnit?->value; }}