src/Entity/Language.php line 23

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Knp\DoctrineBehaviors\Contract\Entity\SoftDeletableInterface;
  4. use Knp\DoctrineBehaviors\Model\SoftDeletable\SoftDeletableTrait;
  5. use Knp\DoctrineBehaviors\Model\Blameable\BlameableTrait;
  6. use Knp\DoctrineBehaviors\Contract\Entity\BlameableInterface;
  7. use Knp\DoctrineBehaviors\Model\Timestampable\TimestampableTrait;
  8. use Knp\DoctrineBehaviors\Contract\Entity\TimestampableInterface;
  9. use Knp\DoctrineBehaviors\Model\Translatable\TranslatableTrait;
  10. use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface;
  11. use Doctrine\ORM\Mapping as ORM;
  12. /**
  13.  * @Doctrine\ORM\Mapping\Entity
  14.  * @Doctrine\ORM\Mapping\Table(name="language")
  15.  */
  16. class Language implements TranslatableInterfaceBlameableInterfaceTimestampableInterfaceSoftDeletableInterface  {
  17.     use BlameableTrait;
  18.     use TimestampableTrait;
  19.     use TranslatableTrait;
  20.     use SoftDeletableTrait;
  21.     
  22.     
  23.     
  24.     /**
  25.      * @Doctrine\ORM\Mapping\Id
  26.      * @Doctrine\ORM\Mapping\Column(type="integer")
  27.      * @Doctrine\ORM\Mapping\GeneratedValue(strategy="AUTO")
  28.      */
  29.     protected $id;
  30.     /**
  31.      * @Doctrine\ORM\Mapping\Column(type="string", length=5)
  32.      */
  33.     protected $locale;
  34.     /**
  35.      * @Doctrine\ORM\Mapping\Column(type="text")
  36.      */
  37.     protected $domain;
  38.     /**
  39.      * @Doctrine\ORM\Mapping\Column(type="boolean", options={"default"=0})
  40.      */
  41.     protected $isActive;
  42.     /**
  43.      * @Doctrine\ORM\Mapping\Column(type="boolean", options={"default"=0})
  44.      */
  45.     protected $isDefault;
  46.     /**
  47.      * @Doctrine\ORM\Mapping\ManyToOne(targetEntity="App\Entity\Currency")
  48.      * @Doctrine\ORM\Mapping\JoinColumn(name="currency_id", referencedColumnName="id")
  49.      */
  50.     protected $currency;
  51.     /**
  52.      * @var string
  53.      *
  54.      * @ORM\Column(name="helpline", type="string", length=255, nullable=true)
  55.      */
  56.     private $helpline;
  57.     /**
  58.      * @var string
  59.      *
  60.      * @ORM\Column(name="rounding_precision", type="string", length=255, nullable=true, options={"default"=2})
  61.      */
  62.     private $roundingPrecision 2;
  63.     /**
  64.      * @var string
  65.      *
  66.      * @ORM\Column(name="phone", type="string", length=255, nullable=true)
  67.      */
  68.     private $phone;
  69.     /**
  70.      * @var string
  71.      *
  72.      * @ORM\Column(name="address", type="string", length=255, nullable=true)
  73.      */
  74.     private $address;
  75.     /**
  76.      * @var string
  77.      *
  78.      * @ORM\Column(name="shop_name", type="string", length=255, nullable=true)
  79.      */
  80.     private $shopName;
  81.     /**
  82.      * @var string
  83.      *
  84.      * @ORM\Column(name="email", type="string", length=255, nullable=true)
  85.      */
  86.     private $email;
  87.     /**
  88.      * @var string
  89.      *
  90.      * @ORM\Column(name="facebook", type="string", length=255, nullable=true)
  91.      */
  92.     private $facebook;
  93.     /**
  94.      * @var string
  95.      *
  96.      * @ORM\Column(name="instagram", type="string", length=255, nullable=true)
  97.      */
  98.     private $instagram;
  99.     /**
  100.      * @var string
  101.      *
  102.      * @ORM\Column(name="youtube", type="string", length=255, nullable=true)
  103.      */
  104.     private $youtube;
  105.     /**
  106.      * @var string
  107.      *
  108.      * @ORM\Column(name="store_url", type="string", length=255, nullable=true)
  109.      */
  110.     private $storeUrl;
  111.     /**
  112.      * @Doctrine\ORM\Mapping\Column(name="password_protected", type="boolean", options={"default"=0}, nullable=true)
  113.      */
  114.     protected $passwordProtected;
  115.     /**
  116.      * @var string
  117.      *
  118.      * @ORM\Column(name="store_password", type="string", length=255, nullable=true)
  119.      */
  120.     private $password;
  121.     /**
  122.      * @Doctrine\ORM\Mapping\Column(type="string", name="fb_pixel", length=255, nullable=true)
  123.      */
  124.     protected $fbPixel;
  125.     /**
  126.      * @Doctrine\ORM\Mapping\Column(type="text", name="fb_token", nullable=true)
  127.      */
  128.     protected $fbToken;
  129.     /**
  130.      * @Doctrine\ORM\Mapping\Column(type="boolean", options={"default"=0}, name="is_comments")
  131.      */
  132.     protected $isComments;
  133.     /**
  134.      * @Doctrine\ORM\Mapping\Column(type="integer", options={"default"=0}, name="send_comment_request_days")
  135.      */
  136.     protected $sendCommentRequestDays;
  137.     /**
  138.      * @return string
  139.      */
  140.     public function getStoreEmail()
  141.     {
  142.         return $this->storeEmail;
  143.     }
  144.     /**
  145.      * @param string $storeEmail
  146.      */
  147.     public function setStoreEmail(string $storeEmail)
  148.     {
  149.         $this->storeEmail $storeEmail;
  150.     }
  151.     /**
  152.      * @return string
  153.      */
  154.     public function getGetResponseCampaignId()
  155.     {
  156.         return $this->getResponseCampaignId;
  157.     }
  158.     /**
  159.      * @param string $getResponseCampaignId
  160.      */
  161.     public function setGetResponseCampaignId(string $getResponseCampaignId)
  162.     {
  163.         $this->getResponseCampaignId $getResponseCampaignId;
  164.     }
  165.     /**
  166.      * @var string
  167.      *
  168.      * @ORM\Column(name="store_email", type="string", length=255, nullable=true)
  169.      */
  170.     private $storeEmail;
  171.     /**
  172.      * @return string
  173.      */
  174.     public function getAdminStoreEmail()
  175.     {
  176.         return $this->adminStoreEmail;
  177.     }
  178.     /**
  179.      * @param string $adminStoreEmail
  180.      */
  181.     public function setAdminStoreEmail(string $adminStoreEmail)
  182.     {
  183.         $this->adminStoreEmail $adminStoreEmail;
  184.     }
  185.     /**
  186.      * @var string
  187.      *
  188.      * @ORM\Column(name="admin_store_email", type="string", length=255, nullable=true)
  189.      */
  190.     private $adminStoreEmail;
  191.     /**
  192.      * @var string
  193.      *
  194.      * @ORM\Column(name="complaint_email", type="string", length=255, nullable=true)
  195.      */
  196.     private $complaintEmail;
  197.     /**
  198.      * @var string
  199.      *
  200.      * @ORM\Column(name="product_return_email", type="string", length=255, nullable=true)
  201.      */
  202.     private $productReturnEmail;
  203.     /**
  204.      * @var string
  205.      *
  206.      * @ORM\Column(name="getresponse_campaign_id", type="string", length=255, nullable=true)
  207.      */
  208.     private $getResponseCampaignId;
  209.     /**
  210.      * @return string
  211.      */
  212.     public function getInstagram()
  213.     {
  214.         return $this->instagram;
  215.     }
  216.     /**
  217.      * @param string $instagram
  218.      */
  219.     public function setInstagram(string $instagram): void
  220.     {
  221.         $this->instagram $instagram;
  222.     }
  223.     /**
  224.      * @return string
  225.      */
  226.     public function getStoreUrl()
  227.     {
  228.         return $this->storeUrl;
  229.     }
  230.     /**
  231.      * @param string $storeUrl
  232.      */
  233.     public function setStoreUrl(string $storeUrl): void
  234.     {
  235.         $this->storeUrl $storeUrl;
  236.     }
  237.     public function __construct()
  238.     {
  239.     }
  240.     public function getId()
  241.     {
  242.         return $this->id;
  243.     }
  244.     
  245.     /**
  246.      * Set locale
  247.      *
  248.      * @param string $locale
  249.      * @return Language
  250.      */
  251.     public function setLocale($locale)
  252.     {
  253.         $this->locale $locale;
  254.         return $this;
  255.     }
  256.     /**
  257.      * Get locale
  258.      *
  259.      * @return string
  260.      */
  261.     public function getLocale()
  262.     {
  263.         return $this->locale;
  264.     }
  265.     public function getLocaleShort()
  266.     {
  267.         return substr($this->getLocale(), 02);
  268.     }
  269.     /**
  270.      * Set isActive
  271.      *
  272.      * @param boolean $isActive
  273.      * @return Language
  274.      */
  275.     public function setIsActive($isActive)
  276.     {
  277.         $this->isActive $isActive;
  278.         return $this;
  279.     }
  280.     /**
  281.      * Get isActive
  282.      *
  283.      * @return boolean
  284.      */
  285.     public function getIsActive()
  286.     {
  287.         return $this->isActive;
  288.     }
  289.     /**
  290.      * Set isDefault
  291.      *
  292.      * @param boolean $isDefault
  293.      * @return Language
  294.      */
  295.     public function setIsDefault($isDefault)
  296.     {
  297.         $this->isDefault $isDefault;
  298.         return $this;
  299.     }
  300.     /**
  301.      * Get isDefault
  302.      *
  303.      * @return boolean
  304.      */
  305.     public function getIsDefault()
  306.     {
  307.         return $this->isDefault;
  308.     }
  309.     /**
  310.      * Obsługa tłumaczeń
  311.      * @param $method
  312.      * @param $arguments
  313.      * @return mixed
  314.      */
  315.     public function __call($method$arguments)
  316.     {
  317.         return $this->proxyCurrentLocaleTranslation($method$arguments);
  318.     }
  319.     public function getName(){
  320.         return $this->translate()->getName();
  321.     }
  322.     /**
  323.      * Set currency
  324.      *
  325.      * @param \App\Entity\Currency $currency
  326.      *
  327.      * @return Language
  328.      */
  329.     public function setCurrency(\App\Entity\Currency $currency null)
  330.     {
  331.         $this->currency $currency;
  332.         return $this;
  333.     }
  334.     /**
  335.      * Get currency
  336.      *
  337.      * @return \App\Entity\Currency
  338.      */
  339.     public function getCurrency()
  340.     {
  341.         return $this->currency;
  342.     }
  343.     public function getDomain(): ?string
  344.     {
  345.         return $this->domain;
  346.     }
  347.     public function setDomain(string $domain): self
  348.     {
  349.         $this->domain $domain;
  350.         return $this;
  351.     }
  352.     public function getHelpline(): ?string
  353.     {
  354.         return $this->helpline;
  355.     }
  356.     public function setHelpline(?string $helpline): self
  357.     {
  358.         $this->helpline $helpline;
  359.         return $this;
  360.     }
  361.     public function getPhone(): ?string
  362.     {
  363.         return $this->phone;
  364.     }
  365.     public function setPhone(?string $phone): self
  366.     {
  367.         $this->phone $phone;
  368.         return $this;
  369.     }
  370.     public function getAddress(): ?string
  371.     {
  372.         return $this->address;
  373.     }
  374.     public function setAddress(?string $address): self
  375.     {
  376.         $this->address $address;
  377.         return $this;
  378.     }
  379.     public function getShopName(): ?string
  380.     {
  381.         return $this->shopName;
  382.     }
  383.     public function setShopName(?string $shopName): self
  384.     {
  385.         $this->shopName $shopName;
  386.         return $this;
  387.     }
  388.     public function getEmail(): ?string
  389.     {
  390.         return $this->email;
  391.     }
  392.     public function setEmail(?string $email): self
  393.     {
  394.         $this->email $email;
  395.         return $this;
  396.     }
  397.     public function getFacebook(): ?string
  398.     {
  399.         return $this->facebook;
  400.     }
  401.     public function setFacebook(?string $facebook): self
  402.     {
  403.         $this->facebook $facebook;
  404.         return $this;
  405.     }
  406.     public function getYoutube(): ?string
  407.     {
  408.         return $this->youtube;
  409.     }
  410.     public function setYoutube(?string $youtube): self
  411.     {
  412.         $this->youtube $youtube;
  413.         return $this;
  414.     }
  415.     /**
  416.      * @return string
  417.      */
  418.     public function getRoundingPrecision()
  419.     {
  420.         return $this->roundingPrecision;
  421.     }
  422.     /**
  423.      * @param string $roundingPrecision
  424.      */
  425.     public function setRoundingPrecision($roundingPrecision)
  426.     {
  427.         $this->roundingPrecision $roundingPrecision;
  428.     }
  429.     public function getPrecision() {
  430.         $precision $this->getRoundingPrecision();
  431.         return $precision;
  432.     }
  433.     /**
  434.      * @return mixed
  435.      */
  436.     public function getPasswordProtected()
  437.     {
  438.         return $this->passwordProtected;
  439.     }
  440.     /**
  441.      * @param mixed $passwordProtected
  442.      */
  443.     public function setPasswordProtected($passwordProtected)
  444.     {
  445.         $this->passwordProtected $passwordProtected;
  446.     }
  447.     /**
  448.      * @return string
  449.      */
  450.     public function getPassword()
  451.     {
  452.         return $this->password;
  453.     }
  454.     /**
  455.      * @param string $password
  456.      */
  457.     public function setPassword($password)
  458.     {
  459.         $this->password $password;
  460.     }
  461.     public function getGa4Code() {
  462.         if ($this->getId() == 1) {
  463.             return 'PLN';
  464.         }
  465.         if ($this->getId() == 2) {
  466.             return 'CZK';
  467.         }
  468.         if ($this->getId() == 3) {
  469.             return 'EUR';
  470.         }
  471.         if ($this->getId() == 4) {
  472.             return 'RON';
  473.         }
  474.         return 'PLN';
  475.     }
  476.     /**
  477.      * @return string
  478.      */
  479.     public function getComplaintEmail()
  480.     {
  481.         return $this->complaintEmail;
  482.     }
  483.     /**
  484.      * @param string $complaintEmail
  485.      */
  486.     public function setComplaintEmail($complaintEmail): void
  487.     {
  488.         $this->complaintEmail $complaintEmail;
  489.     }
  490.     /**
  491.      * @return string
  492.      */
  493.     public function getProductReturnEmail()
  494.     {
  495.         return $this->productReturnEmail;
  496.     }
  497.     /**
  498.      * @param string $productReturnEmail
  499.      */
  500.     public function setProductReturnEmail($productReturnEmail)
  501.     {
  502.         $this->productReturnEmail $productReturnEmail;
  503.     }
  504.     /**
  505.      * @return mixed
  506.      */
  507.     public function getFbPixel()
  508.     {
  509.         return $this->fbPixel;
  510.     }
  511.     /**
  512.      * @param mixed $fbPixel
  513.      */
  514.     public function setFbPixel($fbPixel): void
  515.     {
  516.         $this->fbPixel $fbPixel;
  517.     }
  518.     /**
  519.      * @return mixed
  520.      */
  521.     public function getFbToken()
  522.     {
  523.         return $this->fbToken;
  524.     }
  525.     /**
  526.      * @param mixed $fbToken
  527.      */
  528.     public function setFbToken($fbToken): void
  529.     {
  530.         $this->fbToken $fbToken;
  531.     }
  532.     /**
  533.      * @return mixed
  534.      */
  535.     public function getIsComments()
  536.     {
  537.         return $this->isComments;
  538.     }
  539.     /**
  540.      * @param mixed $isComments
  541.      */
  542.     public function setIsComments($isComments): void
  543.     {
  544.         $this->isComments $isComments;
  545.     }
  546.     /**
  547.      * @return mixed
  548.      */
  549.     public function getSendCommentRequestDays()
  550.     {
  551.         return $this->sendCommentRequestDays;
  552.     }
  553.     /**
  554.      * @param mixed $sendCommentRequestDays
  555.      */
  556.     public function setSendCommentRequestDays($sendCommentRequestDays): void
  557.     {
  558.         $this->sendCommentRequestDays $sendCommentRequestDays;
  559.     }
  560. }