101 lines
1.9 KiB
PHP
101 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Entity;
|
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
////#[ORM\Entity]
|
|
#[ORM\InheritanceType('SINGLE_TABLE')]
|
|
#[ORM\DiscriminatorColumn(name: 'discr', type: 'string')]
|
|
#[ORM\DiscriminatorMap(['person2' => 'Person2', 'employee2' => 'Employee2'])]
|
|
class Person2
|
|
{
|
|
#[ORM\Id]
|
|
#[ORM\GeneratedValue]
|
|
#[ORM\Column(type: 'integer')]
|
|
private int $id;
|
|
|
|
#[ORM\Column(type: 'integer')]
|
|
protected int $age;
|
|
|
|
#[ORM\Column(type: 'string')]
|
|
protected string $name;
|
|
|
|
#[ORM\OneToOne(targetEntity: 'Toothbrush2', cascade: ['persist'])]
|
|
#[ORM\JoinColumn(name: 'toothbrush2_id', referencedColumnName: 'id')]
|
|
protected Toothbrush2 $toothbrush;
|
|
|
|
/**
|
|
* @return int
|
|
*/
|
|
public function getId(): int
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
/**
|
|
* @param int $id
|
|
* @return Person2
|
|
*/
|
|
public function setId(int $id): Person2
|
|
{
|
|
$this->id = $id;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return int
|
|
*/
|
|
public function getAge(): int
|
|
{
|
|
return $this->age;
|
|
}
|
|
|
|
/**
|
|
* @param int $age
|
|
* @return Person2
|
|
*/
|
|
public function setAge(int $age): Person2
|
|
{
|
|
$this->age = $age;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getName(): string
|
|
{
|
|
return $this->name;
|
|
}
|
|
|
|
/**
|
|
* @param string $name
|
|
* @return Person2
|
|
*/
|
|
public function setName(string $name): Person2
|
|
{
|
|
$this->name = $name;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return Toothbrush2
|
|
*/
|
|
public function getToothbrush(): Toothbrush2
|
|
{
|
|
return $this->toothbrush;
|
|
}
|
|
|
|
/**
|
|
* @param Toothbrush2 $toothbrush
|
|
* @return Person2
|
|
*/
|
|
public function setToothbrush(Toothbrush2 $toothbrush): Person2
|
|
{
|
|
$this->toothbrush = $toothbrush;
|
|
return $this;
|
|
}
|
|
|
|
|
|
} |