symfony-playground/src/Entity/Person3.php

101 lines
1.9 KiB
PHP

<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
////#[ORM\Entity]
#[ORM\InheritanceType('JOINED')]
#[ORM\DiscriminatorColumn(name: 'discr', type: 'string')]
#[ORM\DiscriminatorMap(['person3' => 'Person3', 'employee3' => 'Employee3'])]
class Person3
{
#[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: 'Toothbrush3', cascade: ['persist'])]
#[ORM\JoinColumn(name: 'toothbrush3_id', referencedColumnName: 'id')]
protected Toothbrush3 $toothbrush;
/**
* @return int
*/
public function getId(): int
{
return $this->id;
}
/**
* @param int $id
* @return Person3
*/
public function setId(int $id): Person3
{
$this->id = $id;
return $this;
}
/**
* @return int
*/
public function getAge(): int
{
return $this->age;
}
/**
* @param int $age
* @return Person3
*/
public function setAge(int $age): Person3
{
$this->age = $age;
return $this;
}
/**
* @return string
*/
public function getName(): string
{
return $this->name;
}
/**
* @param string $name
* @return Person3
*/
public function setName(string $name): Person3
{
$this->name = $name;
return $this;
}
/**
* @return Toothbrush3
*/
public function getToothbrush(): Toothbrush3
{
return $this->toothbrush;
}
/**
* @param Toothbrush3 $toothbrush
* @return Person3
*/
public function setToothbrush(Toothbrush3 $toothbrush): Person3
{
$this->toothbrush = $toothbrush;
return $this;
}
}