You've already forked symfony-playground
inheritance
This commit is contained in:
75
src/Entity/Person1.php
Normal file
75
src/Entity/Person1.php
Normal file
@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\MappedSuperclass]
|
||||
class Person1
|
||||
{
|
||||
#[ORM\Column(type: 'integer')]
|
||||
protected int $age;
|
||||
|
||||
#[ORM\Column(type: 'string')]
|
||||
protected string $name;
|
||||
|
||||
#[ORM\OneToOne(targetEntity: 'Toothbrush1', cascade: ['persist'])]
|
||||
#[ORM\JoinColumn(name: 'toothbrush1_id', referencedColumnName: 'id')]
|
||||
protected Toothbrush1 $toothbrush;
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getAge(): int
|
||||
{
|
||||
return $this->age;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $age
|
||||
* @return Person1
|
||||
*/
|
||||
public function setAge(int $age): Person1
|
||||
{
|
||||
$this->age = $age;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return Person1
|
||||
*/
|
||||
public function setName(string $name): Person1
|
||||
{
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Toothbrush1
|
||||
*/
|
||||
public function getToothbrush(): Toothbrush1
|
||||
{
|
||||
return $this->toothbrush;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Toothbrush1 $toothbrush
|
||||
* @return Person1
|
||||
*/
|
||||
public function setToothbrush(Toothbrush1 $toothbrush): Person1
|
||||
{
|
||||
$this->toothbrush = $toothbrush;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user