<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity
* @ORM\Table(
* name="company_address",
* options={"collate"="utf8_swedish_ci"}
* )
* @ORM\HasLifecycleCallbacks
* @ORM\InheritanceType("SINGLE_TABLE")
* @ORM\DiscriminatorColumn(
* name="entity",
* type="string",
* length=50
* )
* @ORM\DiscriminatorMap({
* "invoice"="CompanyInvoiceAddress",
* "delivery"="CompanyDeliveryAddress",
* "consignee"="CompanyConsigneeAddress",
* "document"="CompanyDocumentAddress"
* })
*/
abstract class CompanyAddress implements EntityInterface, AddressInterface
{
use AddressTrait;
/**
* @ORM\Id
* @ORM\Column(
* type="integer"
* )
* @ORM\GeneratedValue(
* strategy="AUTO"
* )
*
* @var int|null
*/
protected ?int $id = null;
/**
* @ORM\Column(
* type="string",
* length=200
* )
* @Assert\NotBlank
*
* @var string
*/
protected string $name;
/**
* @param string $name
*/
protected function __construct(string $name)
{
$this->name = $name;
}
/**
* @return Company|null
*/
abstract function getCompany(): ?Company;
/**
* @return int|null
*/
public function getId(): ?int
{
return $this->id;
}
/**
* @return string
*/
public function getName(): string
{
return $this->name;
}
/**
* @return string
*/
abstract public function getType(): string;
}