<?php
namespace App\Entity\Embeddables;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Embeddable()
*/
class DateTimeRichField extends AbstractRichField implements RichFieldInterface
{
/**
* @var string | null
*
* @ORM\Column(type="datetime", nullable=true)
*/
protected $value;
/**
* @var string | null
*
* @ORM\Column(type="string", nullable=true)
*/
protected $backgroundColor;
/**
* @var string | null
*
* @ORM\Column(type="string", nullable=true)
*/
protected $textColor;
public function __toString()
{
if ($this->value instanceof \DateTime) {
return $this->value->format('Y-m-d');
}
return (string)$this->value;
}
}