src/Entity/CompanyAddress.php line 28

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Symfony\Component\Validator\Constraints as Assert;
  5. /**
  6.  * @ORM\Entity
  7.  * @ORM\Table(
  8.  *     name="company_address",
  9.  *     options={"collate"="utf8_swedish_ci"}
  10.  * )
  11.  * @ORM\HasLifecycleCallbacks
  12.  * @ORM\InheritanceType("SINGLE_TABLE")
  13.  * @ORM\DiscriminatorColumn(
  14.  *     name="entity",
  15.  *     type="string",
  16.  *     length=50
  17.  * )
  18.  * @ORM\DiscriminatorMap({
  19.  *     "invoice"="CompanyInvoiceAddress",
  20.  *     "delivery"="CompanyDeliveryAddress",
  21.  *     "consignee"="CompanyConsigneeAddress",
  22.  *     "document"="CompanyDocumentAddress"
  23.  * })
  24.  */
  25. abstract class CompanyAddress implements EntityInterfaceAddressInterface
  26. {
  27.     use AddressTrait;
  28.     /**
  29.      * @ORM\Id
  30.      * @ORM\Column(
  31.      *     type="integer"
  32.      * )
  33.      * @ORM\GeneratedValue(
  34.      *     strategy="AUTO"
  35.      * )
  36.      *
  37.      * @var int|null
  38.      */
  39.     protected ?int $id null;
  40.     /**
  41.      * @ORM\Column(
  42.      *     type="string",
  43.      *     length=200
  44.      * )
  45.      * @Assert\NotBlank
  46.      *
  47.      * @var string
  48.      */
  49.     protected string $name;
  50.     /**
  51.      * @param string $name
  52.      */
  53.     protected function __construct(string $name)
  54.     {
  55.         $this->name $name;
  56.     }
  57.     /**
  58.      * @return Company|null
  59.      */
  60.     abstract function getCompany(): ?Company;
  61.     /**
  62.      * @return int|null
  63.      */
  64.     public function getId(): ?int
  65.     {
  66.         return $this->id;
  67.     }
  68.     /**
  69.      * @return string
  70.      */
  71.     public function getName(): string
  72.     {
  73.         return $this->name;
  74.     }
  75.     /**
  76.      * @return string
  77.      */
  78.     abstract public function getType(): string;
  79. }