UsageStatEntity::class, 'signup' => SignupStatEntity::class, 'subscription' => SubscriptionStatEntity::class, 'order' => OrderStatEntity::class, ])] #[ORM\Index(columns: ['date'])] #[ORM\Index(columns: ['country_code'])] abstract class AbstractStatEntity { /** A unique numeric identifier of the entity. */ #[ORM\Embedded(class: Id::class, columnPrefix: false)] private Id $id; #[ORM\Column(type: Types::DATE_IMMUTABLE, name: 'date')] private DateTimeInterface $date; #[ORM\Embedded(class: Metric::class, columnPrefix: false)] private Metric $metric; public function __construct() { $this->id = new Id(); $this->date = new DateTimeImmutable(); $this->metric = new Metric(0); } public function getId(): Id { return $this->id; } public function getMetric(): Metric { return $this->metric; } public function incrementMetric(Metric $metric = new Metric(1)): void { $this->metric = new Metric($this->metric->value + $metric->value); } public function getDate(): DateTimeInterface { return $this->date; } }