Added basic fields and migration for MySQL

This commit is contained in:
Jan Böhmer 2023-04-02 19:10:36 +02:00
parent e7e57fa412
commit 047c82791b
4 changed files with 138 additions and 0 deletions

View file

@ -26,6 +26,7 @@ use App\Entity\Base\AbstractDBElement;
use App\Entity\Base\TimestampTrait;
use App\Entity\Contracts\NamedElementInterface;
use App\Entity\Contracts\TimeStampableInterface;
use App\Entity\UserSystem\User;
use App\Validator\Constraints\Selectable;
use App\Validator\Constraints\ValidPartLot;
use DateTime;
@ -111,6 +112,13 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
*/
protected Part $part;
/**
* @var User|null The owner of this part lot
* @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\User")
* @ORM\JoinColumn(name="id_owner", referencedColumnName="id", nullable=true, onDelete="SET NULL")
*/
protected ?User $owner;
public function __clone()
{
if ($this->id) {
@ -304,6 +312,28 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
return $this;
}
/**
* Returns the owner of this part lot.
* @return User|null
*/
public function getOwner(): ?User
{
return $this->owner;
}
/**
* Sets the owner of this part lot.
* @param User|null $owner
* @return PartLot
*/
public function setOwner(?User $owner): PartLot
{
$this->owner = $owner;
return $this;
}
public function getName(): string
{
return $this->description;