<?php
namespace App\Entity;
use App\Repository\UserInformationRepository;
use App\String\Constant;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: UserInformationRepository::class)]
class UserInformation
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $website;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $facebook;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $twitter;
#[ORM\OneToOne(inversedBy: 'userInformation', targetEntity: User::class, cascade: ['persist', 'remove'])]
private $user;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $xeroId;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $salesforceId;
#[ORM\Column(type: 'integer', nullable: true)]
private $wordpressId;
public function getId(): ?int
{
return $this->id;
}
public function getWebsite(): ?string
{
return $this->website;
}
public function setWebsite(?string $website): self
{
$this->website = $website;
return $this;
}
public function getFacebook(): ?string
{
return $this->facebook;
}
public function setFacebook(?string $facebook): self
{
$this->facebook = $facebook;
return $this;
}
public function getTwitter(): ?string
{
return $this->twitter;
}
public function setTwitter(?string $twitter): self
{
$this->twitter = $twitter;
return $this;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
public function getXeroId(): ?string
{
return $this->xeroId;
}
public function setXeroId(?string $xeroId): self
{
$this->xeroId = $xeroId;
return $this;
}
public function getSalesforceId(): ?string
{
return $this->salesforceId;
}
public function setSalesforceId(?string $salesforceId): self
{
$this->salesforceId = $salesforceId;
return $this;
}
public function getWordpressId(): ?int
{
return $this->wordpressId;
}
public function setWordpressId(?int $wordpressId): self
{
$this->wordpressId = $wordpressId;
return $this;
}
public function getIntegrationUrl(string $type): string
{
$url = '';
switch($type) {
case 'salesforce':
$url = Constant::SALESFORCE_URL . '/lightning/r/Contact/'. $this->salesforceId .'/view';
break;
case 'wordpress':
$url = Constant::WORDPRESS_URL . '/author';
break;
}
return $url;
}
}