src/Entity/CompanyProfile.php line 35

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CompanyProfileRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\Serializer\Annotation\Groups;
  6. /**
  7.  * FIRMA KUNYESI — bu kurulumun sahibi firma (singleton, tek satir).
  8.  *
  9.  * 2026-09-27'ye kadar adi `administrative` idi ve yalnizca iki is yapiyordu: hangi partner'in
  10.  * "biz" oldugunu isaretlemek + bir `company_name` kopyasi tutmak. Kullanici karari ile tablo
  11.  * KUNYEYE terfi etti; ad kopyasi KALDIRILDI.
  12.  *
  13.  * ── Model karari (kullanici karari 2026-09-27, 2. tur) ───────────────────────
  14.  * KUNYE TEK DUZENLEME NOKTASIDIR: firmaya ait her sey (ad, adres, iletisim, yasal kimlikler,
  15.  * banka, odeme sartlari, tanitim) BU tabloda durur ve Ayarlar → Firma'dan yazilir.
  16.  * Kullanicinin sozu: *"butun company ile ilgili editlerimi buradan yapiyor olabilmem lazim"*.
  17.  *
  18.  * 🔁 PARTNER'a TEK YONLU SENKRON: kayit sonrasi `name/tel/email/city/country` partner kaydina
  19.  *    yazilir — `partner.company` NOT NULL'dir ve projeler/teklifler adi ORADAN okur.
  20.  *    Akis DAIMA kunye → partner; ters yon YOKTUR. Partner ekraninda bu kayit kilitli gosterilir.
  21.  *
  22.  * 🪤 Once `company_name` diye bir KOPYA kolon vardi ve partner kaynakti; ayristigi icin dusuruldu
  23.  *    ("Romon Engeering GmbH" vs "ROMON Engineering GmbH"). Buradaki `name` onun devami DEGIL:
  24.  *    yon tersine dondu, artik kaynak burasi. Partner'dan kunyeye ASLA yazilmaz.
  25.  *
  26.  * 🤖 `about_short` / `about_long` yapay zeka icin de kaynaktir: AI Hub'a giden ayar belgesine
  27.  *    (`DesktopSettingsService::hubDocument()`) `company` bolumu olarak girer.
  28.  *
  29.  * @ORM\Entity(repositoryClass=CompanyProfileRepository::class)
  30.  * @ORM\Table(name="company_profile")
  31.  */
  32. class CompanyProfile
  33. {
  34.     /**
  35.      * @ORM\Id
  36.      * @ORM\GeneratedValue
  37.      * @ORM\Column(type="integer")
  38.      * @Groups({
  39.      *     "partner.manage.base",
  40.      *     "partner.list.base",
  41.      *     "worker.actually.activity",
  42.      *     "company_profile@ref",
  43.      *     "company_profile@base",
  44.      *     "company_profile@core"
  45.      * })
  46.      */
  47.     private $id;
  48.     /**
  49.      * Firmanin PARTNER kaydi — kimlik, adres, telefon, e-posta oradan okunur.
  50.      *
  51.      * 🪤 `cascade` icinde **`remove` YOK** (2026-09-30 bulgusu): kunyeyi silmek PARTNERI de
  52.      *    siliyordu, partner silinince de `worker_activities` / `project_stakeholders`
  53.      *    ON DELETE CASCADE ile gidiyordu — yani "eslesmeyi kaldir" firmanin TUM calisan
  54.      *    sozlesmelerini silmeye kalkiyordu. Yalniz `project_order_tasks` FK'si patladigi icin
  55.      *    (1451) veri kaybi yasanmadi; test `testUnpairRemovesTheProfileRow` bunu yakaladi.
  56.      *    Kunye TUREVDIR, partner bagimsiz kayittir — silme asla yukari akmaz.
  57.      *
  58.      * @ORM\OneToOne(targetEntity=Partner::class, inversedBy="companyProfile", cascade={"persist"})
  59.      * @ORM\JoinColumn(name="paired_partner_id", nullable=false)
  60.      * @Groups({ "company_profile@core" })
  61.      */
  62.     private $paired_partner;
  63.     // ── Kimlik (TEK KAYNAK — partner'a senkronlanir) ────────────────────────
  64.     /**
  65.      * Firma adi. `partner.company` bunun TUREVIDIR (NOT NULL oldugu icin senkron sarttir).
  66.      *
  67.      * @ORM\Column(type="string", length=255, nullable=true)
  68.      * @Groups({ "company_profile@base", "company_profile@core" })
  69.      */
  70.     private $name;
  71.     /**
  72.      * @ORM\Column(type="string", length=64, nullable=true)
  73.      * @Groups({ "company_profile@core" })
  74.      */
  75.     private $tel;
  76.     /**
  77.      * @ORM\Column(type="string", length=255, nullable=true)
  78.      * @Groups({ "company_profile@core" })
  79.      */
  80.     private $email;
  81.     // ── Adres (kullanici karari: duz alanlar, ayri tabloya gidilmez) ────────
  82.     /**
  83.      * @ORM\Column(type="string", length=255, nullable=true)
  84.      * @Groups({ "company_profile@core" })
  85.      */
  86.     private $street;
  87.     /**
  88.      * @ORM\Column(type="string", length=32, nullable=true)
  89.      * @Groups({ "company_profile@core" })
  90.      */
  91.     private $house_number;
  92.     /**
  93.      * @ORM\Column(type="string", length=25, nullable=true)
  94.      * @Groups({ "company_profile@core" })
  95.      */
  96.     private $postcode;
  97.     /**
  98.      * @ORM\Column(type="string", length=128, nullable=true)
  99.      * @Groups({ "company_profile@core" })
  100.      */
  101.     private $city;
  102.     /**
  103.      * @ORM\ManyToOne(targetEntity=Countries::class)
  104.      * @ORM\JoinColumn(name="country_id", nullable=true)
  105.      * @Groups({ "company_profile@core" })
  106.      */
  107.     private $country;
  108.     // ── Yasal kimlik ────────────────────────────────────────────────────────
  109.     /** Ticaret unvani (partner adindan farkliysa; fatura/teklif basliginda kullanilir).
  110.      * @ORM\Column(type="string", length=255, nullable=true)
  111.      * @Groups({ "company_profile@core" })
  112.      */
  113.     private $legal_name;
  114.     /**
  115.      * @ORM\Column(type="string", length=64, nullable=true)
  116.      * @Groups({ "company_profile@core" })
  117.      */
  118.     private $tax_no;
  119.     /** USt-IdNr / VAT ID.
  120.      * @ORM\Column(type="string", length=64, nullable=true)
  121.      * @Groups({ "company_profile@core" })
  122.      */
  123.     private $vat_id;
  124.     /** Handelsregister no (ör. HRB 12345).
  125.      * @ORM\Column(type="string", length=128, nullable=true)
  126.      * @Groups({ "company_profile@core" })
  127.      */
  128.     private $trade_register;
  129.     /** Sicilin tutuldugu mahkeme (Amtsgericht).
  130.      * @ORM\Column(type="string", length=128, nullable=true)
  131.      * @Groups({ "company_profile@core" })
  132.      */
  133.     private $register_court;
  134.     /** Yetkili / genel mudur — imza sirkulerinde gorunen ad.
  135.      * @ORM\Column(type="string", length=255, nullable=true)
  136.      * @Groups({ "company_profile@core" })
  137.      */
  138.     private $managing_director;
  139.     // ── Banka ───────────────────────────────────────────────────────────────
  140.     /**
  141.      * @ORM\Column(type="string", length=255, nullable=true)
  142.      * @Groups({ "company_profile@core" })
  143.      */
  144.     private $bank_name;
  145.     /**
  146.      * @ORM\Column(type="string", length=64, nullable=true)
  147.      * @Groups({ "company_profile@core" })
  148.      */
  149.     private $iban;
  150.     /**
  151.      * @ORM\Column(type="string", length=32, nullable=true)
  152.      * @Groups({ "company_profile@core" })
  153.      */
  154.     private $bic;
  155.     // ── Ticari sartlar ──────────────────────────────────────────────────────
  156.     /** Odeme vadesi (gun). Musteri bazinda ezilebilir — burasi firmanin VARSAYILANI.
  157.      * @ORM\Column(type="integer", nullable=true)
  158.      * @Groups({ "company_profile@core" })
  159.      */
  160.     private $payment_terms_days;
  161.     /** Serbest metin sart notu (gecikme faizi, erken odeme indirimi…).
  162.      * @ORM\Column(type="string", length=500, nullable=true)
  163.      * @Groups({ "company_profile@core" })
  164.      */
  165.     private $payment_terms_note;
  166.     // ── Tanitim / biyografi (AI kaynagi) ────────────────────────────────────
  167.     /** Tek cumlelik tanitim.
  168.      * @ORM\Column(type="string", length=500, nullable=true)
  169.      * @Groups({ "company_profile@core" })
  170.      */
  171.     private $about_short;
  172.     /** Uzun tanitim / biyografi — AI belgesine bu metin girer.
  173.      * @ORM\Column(type="text", nullable=true)
  174.      * @Groups({ "company_profile@core" })
  175.      */
  176.     private $about_long;
  177.     // ── Surum damgasi (desktop_settings kalibi) ─────────────────────────────
  178.     /**
  179.      * @ORM\Column(type="integer", options={"default": 0})
  180.      * @Groups({ "company_profile@core" })
  181.      */
  182.     private $version = 0;
  183.     /**
  184.      * @ORM\Column(type="datetime", nullable=true)
  185.      * @Groups({ "company_profile@core" })
  186.      */
  187.     private $updated_at;
  188.     /**
  189.      * @ORM\Column(type="string", length=255, nullable=true)
  190.      * @Groups({ "company_profile@core" })
  191.      */
  192.     private $updated_by;
  193.     public function getId(): ?int
  194.     {
  195.         return $this->id;
  196.     }
  197.     public function getPairedPartner(): ?Partner
  198.     {
  199.         return $this->paired_partner;
  200.     }
  201.     public function setPairedPartner(Partner $paired_partner): self
  202.     {
  203.         $this->paired_partner = $paired_partner;
  204.         return $this;
  205.     }
  206.     /** Firmanin adi — TEK kaynak BU tablodur; kunye bos ise partner'dan okunur (gecis dolumu). */
  207.     public function getCompanyName(): ?string
  208.     {
  209.         if ($this->name !== null && trim($this->name) !== '') {
  210.             return $this->name;
  211.         }
  212.         return $this->paired_partner ? $this->paired_partner->getCompany() : null;
  213.     }
  214.     public function getName(): ?string
  215.     {
  216.         return $this->name;
  217.     }
  218.     public function setName(?string $name): self
  219.     {
  220.         $this->name = $name;
  221.         return $this;
  222.     }
  223.     public function getTel(): ?string
  224.     {
  225.         return $this->tel;
  226.     }
  227.     public function setTel(?string $tel): self
  228.     {
  229.         $this->tel = $tel;
  230.         return $this;
  231.     }
  232.     public function getEmail(): ?string
  233.     {
  234.         return $this->email;
  235.     }
  236.     public function setEmail(?string $email): self
  237.     {
  238.         $this->email = $email;
  239.         return $this;
  240.     }
  241.     public function getStreet(): ?string
  242.     {
  243.         return $this->street;
  244.     }
  245.     public function setStreet(?string $street): self
  246.     {
  247.         $this->street = $street;
  248.         return $this;
  249.     }
  250.     public function getHouseNumber(): ?string
  251.     {
  252.         return $this->house_number;
  253.     }
  254.     public function setHouseNumber(?string $house_number): self
  255.     {
  256.         $this->house_number = $house_number;
  257.         return $this;
  258.     }
  259.     public function getPostcode(): ?string
  260.     {
  261.         return $this->postcode;
  262.     }
  263.     public function setPostcode(?string $postcode): self
  264.     {
  265.         $this->postcode = $postcode;
  266.         return $this;
  267.     }
  268.     public function getCity(): ?string
  269.     {
  270.         return $this->city;
  271.     }
  272.     public function setCity(?string $city): self
  273.     {
  274.         $this->city = $city;
  275.         return $this;
  276.     }
  277.     public function getCountry(): ?Countries
  278.     {
  279.         return $this->country;
  280.     }
  281.     public function setCountry(?Countries $country): self
  282.     {
  283.         $this->country = $country;
  284.         return $this;
  285.     }
  286.     public function getLegalName(): ?string
  287.     {
  288.         return $this->legal_name;
  289.     }
  290.     public function setLegalName(?string $legal_name): self
  291.     {
  292.         $this->legal_name = $legal_name;
  293.         return $this;
  294.     }
  295.     public function getTaxNo(): ?string
  296.     {
  297.         return $this->tax_no;
  298.     }
  299.     public function setTaxNo(?string $tax_no): self
  300.     {
  301.         $this->tax_no = $tax_no;
  302.         return $this;
  303.     }
  304.     public function getVatId(): ?string
  305.     {
  306.         return $this->vat_id;
  307.     }
  308.     public function setVatId(?string $vat_id): self
  309.     {
  310.         $this->vat_id = $vat_id;
  311.         return $this;
  312.     }
  313.     public function getTradeRegister(): ?string
  314.     {
  315.         return $this->trade_register;
  316.     }
  317.     public function setTradeRegister(?string $trade_register): self
  318.     {
  319.         $this->trade_register = $trade_register;
  320.         return $this;
  321.     }
  322.     public function getRegisterCourt(): ?string
  323.     {
  324.         return $this->register_court;
  325.     }
  326.     public function setRegisterCourt(?string $register_court): self
  327.     {
  328.         $this->register_court = $register_court;
  329.         return $this;
  330.     }
  331.     public function getManagingDirector(): ?string
  332.     {
  333.         return $this->managing_director;
  334.     }
  335.     public function setManagingDirector(?string $managing_director): self
  336.     {
  337.         $this->managing_director = $managing_director;
  338.         return $this;
  339.     }
  340.     public function getBankName(): ?string
  341.     {
  342.         return $this->bank_name;
  343.     }
  344.     public function setBankName(?string $bank_name): self
  345.     {
  346.         $this->bank_name = $bank_name;
  347.         return $this;
  348.     }
  349.     public function getIban(): ?string
  350.     {
  351.         return $this->iban;
  352.     }
  353.     public function setIban(?string $iban): self
  354.     {
  355.         $this->iban = $iban;
  356.         return $this;
  357.     }
  358.     public function getBic(): ?string
  359.     {
  360.         return $this->bic;
  361.     }
  362.     public function setBic(?string $bic): self
  363.     {
  364.         $this->bic = $bic;
  365.         return $this;
  366.     }
  367.     public function getPaymentTermsDays(): ?int
  368.     {
  369.         return $this->payment_terms_days;
  370.     }
  371.     public function setPaymentTermsDays(?int $payment_terms_days): self
  372.     {
  373.         $this->payment_terms_days = $payment_terms_days;
  374.         return $this;
  375.     }
  376.     public function getPaymentTermsNote(): ?string
  377.     {
  378.         return $this->payment_terms_note;
  379.     }
  380.     public function setPaymentTermsNote(?string $payment_terms_note): self
  381.     {
  382.         $this->payment_terms_note = $payment_terms_note;
  383.         return $this;
  384.     }
  385.     public function getAboutShort(): ?string
  386.     {
  387.         return $this->about_short;
  388.     }
  389.     public function setAboutShort(?string $about_short): self
  390.     {
  391.         $this->about_short = $about_short;
  392.         return $this;
  393.     }
  394.     public function getAboutLong(): ?string
  395.     {
  396.         return $this->about_long;
  397.     }
  398.     public function setAboutLong(?string $about_long): self
  399.     {
  400.         $this->about_long = $about_long;
  401.         return $this;
  402.     }
  403.     public function getVersion(): int
  404.     {
  405.         return (int) $this->version;
  406.     }
  407.     public function setVersion(int $version): self
  408.     {
  409.         $this->version = $version;
  410.         return $this;
  411.     }
  412.     public function getUpdatedAt(): ?\DateTimeInterface
  413.     {
  414.         return $this->updated_at;
  415.     }
  416.     public function setUpdatedAt(?\DateTimeInterface $updated_at): self
  417.     {
  418.         $this->updated_at = $updated_at;
  419.         return $this;
  420.     }
  421.     public function getUpdatedBy(): ?string
  422.     {
  423.         return $this->updated_by;
  424.     }
  425.     public function setUpdatedBy(?string $updated_by): self
  426.     {
  427.         $this->updated_by = $updated_by;
  428.         return $this;
  429.     }
  430. }