File size: 777 Bytes
cf14c12 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | <?php
declare(strict_types=1);
namespace Stat\Domain\Entities;
use Doctrine\ORM\Mapping as ORM;
use Stat\Domain\ValueObjects\Metric;
use Workspace\Domain\Entities\WorkspaceEntity;
#[ORM\Entity]
class UsageStatEntity extends AbstractStatEntity
{
#[ORM\ManyToOne(targetEntity: WorkspaceEntity::class, inversedBy: 'stats')]
#[ORM\JoinColumn(onDelete: 'SET NULL', nullable: true)]
private ?WorkspaceEntity $workspace = null;
public function __construct(
WorkspaceEntity $workspace,
Metric $usage
) {
parent::__construct();
$this->workspace = $workspace;
$this->incrementMetric(
$usage
);
}
public function getWorkspace(): ?WorkspaceEntity
{
return $this->workspace;
}
}
|