82 lines
2.0 KiB
PHP
82 lines
2.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Entity;
|
|
|
|
use App\Entity\Trait\CuidEntityTrait;
|
|
use DateTimeImmutable;
|
|
use Doctrine\DBAL\Types\Types;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
#[ORM\Entity]
|
|
#[ORM\Table(name: 'skeleton_piece_requirements')]
|
|
#[ORM\HasLifecycleCallbacks]
|
|
class SkeletonPieceRequirement
|
|
{
|
|
use CuidEntityTrait;
|
|
|
|
#[ORM\Id]
|
|
#[ORM\Column(type: Types::STRING, length: 36)]
|
|
private ?string $id = null;
|
|
|
|
#[ORM\ManyToOne(targetEntity: ModelType::class, inversedBy: 'skeletonPieceRequirements')]
|
|
#[ORM\JoinColumn(name: 'modelTypeId', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')]
|
|
private ModelType $modelType;
|
|
|
|
#[ORM\ManyToOne(targetEntity: ModelType::class)]
|
|
#[ORM\JoinColumn(name: 'typePieceId', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')]
|
|
private ModelType $typePiece;
|
|
|
|
#[ORM\Column(type: Types::INTEGER, options: ['default' => 0])]
|
|
private int $position = 0;
|
|
|
|
#[ORM\Column(type: Types::DATETIME_IMMUTABLE, name: 'createdAt')]
|
|
private DateTimeImmutable $createdAt;
|
|
|
|
#[ORM\Column(type: Types::DATETIME_IMMUTABLE, name: 'updatedAt')]
|
|
private DateTimeImmutable $updatedAt;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->createdAt = new DateTimeImmutable();
|
|
$this->updatedAt = new DateTimeImmutable();
|
|
}
|
|
|
|
public function getModelType(): ModelType
|
|
{
|
|
return $this->modelType;
|
|
}
|
|
|
|
public function setModelType(ModelType $modelType): static
|
|
{
|
|
$this->modelType = $modelType;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getTypePiece(): ModelType
|
|
{
|
|
return $this->typePiece;
|
|
}
|
|
|
|
public function setTypePiece(ModelType $typePiece): static
|
|
{
|
|
$this->typePiece = $typePiece;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getPosition(): int
|
|
{
|
|
return $this->position;
|
|
}
|
|
|
|
public function setPosition(int $position): static
|
|
{
|
|
$this->position = $position;
|
|
|
|
return $this;
|
|
}
|
|
}
|