mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
add new fields in thirdparty entity
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
|
||||
namespace Chill\ThirdPartyBundle\Entity;
|
||||
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
@@ -41,13 +42,13 @@ use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
|
||||
* @ORM\Entity(repositoryClass="Chill\ThirdPartyBundle\Repository\ThirdPartyRepository")
|
||||
* @DiscriminatorMap(typeProperty="type", mapping={
|
||||
* "thirdparty"=ThirdParty::class
|
||||
*})
|
||||
* })
|
||||
* @ORM\HasLifecycleCallbacks()
|
||||
*/
|
||||
class ThirdParty
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
@@ -56,15 +57,75 @@ class ThirdParty
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="name", type="string", length=255)
|
||||
* @Assert\Length(min="2")
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* [fr] Raison sociale
|
||||
* @var string
|
||||
* @ORM\Column(name="name_company", type="string", length=255, nullable=true)
|
||||
* @Assert\Length(min="3")
|
||||
*/
|
||||
private $nameCompany;
|
||||
|
||||
/**
|
||||
* [fr] Sigle
|
||||
* @var string
|
||||
* @ORM\Column(name="acronym", type="string", length=64, nullable=true)
|
||||
* @Assert\Length(min="2")
|
||||
*/
|
||||
private $acronym;
|
||||
|
||||
/**
|
||||
* @var ThirdPartyCategory
|
||||
* @ORM\ManyToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdPartyCategory")
|
||||
* @ORM\JoinTable(name="chill_3party.thirdparty_category",
|
||||
* joinColumns={@ORM\JoinColumn(name="thirdparty_id", referencedColumnName="id")},
|
||||
* inverseJoinColumns={@ORM\JoinColumn(name="category_id", referencedColumnName="id")})
|
||||
*/
|
||||
private $categories;
|
||||
|
||||
/**
|
||||
* @var array|null
|
||||
* @ORM\Column(name="types", type="json", nullable=true)
|
||||
* @Assert\Count(min=1)
|
||||
*/
|
||||
private $type;
|
||||
|
||||
/**
|
||||
* Contact Persons: One Institutional ThirdParty has Many Contact Persons
|
||||
* @var ThirdParty
|
||||
* @ORM\OneToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty", mappedBy="parent")
|
||||
*/
|
||||
private $children;
|
||||
|
||||
/**
|
||||
* Institutional ThirdParty: Many Contact Persons have One Institutional ThirdParty
|
||||
* @var ThirdParty
|
||||
* @ORM\ManyToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty", inversedBy="children")
|
||||
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
|
||||
*/
|
||||
private $parent;
|
||||
|
||||
/**
|
||||
* @var ThirdPartyCivility
|
||||
* @ORM\OneToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdPartyCivility")
|
||||
* @ORM\JoinColumn(name="civility", referencedColumnName="id", nullable=true)
|
||||
*/
|
||||
private $civility;
|
||||
|
||||
/**
|
||||
* [fr] Qualité
|
||||
* @var ThirdPartyProfession
|
||||
* @ORM\OneToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdPartyProfession")
|
||||
* @ORM\JoinColumn(name="profession", referencedColumnName="id", nullable=true)
|
||||
*/
|
||||
private $profession;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*
|
||||
* @ORM\Column(name="telephone", type="string", length=64, nullable=true)
|
||||
* @Assert\Regex("/^([\+{1}])([0-9\s*]{4,20})$/",
|
||||
* message="Invalid phone number: it should begin with the international prefix starting with ""+"", hold only digits and be smaller than 20 characters. Ex: +33123456789"
|
||||
@@ -74,41 +135,11 @@ class ThirdParty
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*
|
||||
* @ORM\Column(name="email", type="string", length=255, nullable=true)
|
||||
* @Assert\Email(checkMX=false)
|
||||
*/
|
||||
private $email;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*
|
||||
* @ORM\Column(name="comment", type="text", nullable=true)
|
||||
*/
|
||||
private $comment;
|
||||
|
||||
/**
|
||||
* @var array|null
|
||||
*
|
||||
* @ORM\Column(name="types", type="json", nullable=true)
|
||||
* @Assert\Count(min=1)
|
||||
*/
|
||||
private $type;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
* @ORM\Column(name="active", type="boolean", options={"defaut": true})
|
||||
*/
|
||||
private $active = true;
|
||||
|
||||
/**
|
||||
* @var Collection instances of Center
|
||||
* @ORM\ManyToMany(targetEntity="\Chill\MainBundle\Entity\Center")
|
||||
* @ORM\JoinTable(name="chill_3party.party_center")
|
||||
* @Assert\Count(min=1)
|
||||
*/
|
||||
private $centers;
|
||||
|
||||
/**
|
||||
* @var Address|null
|
||||
* @ORM\ManyToOne(targetEntity="\Chill\MainBundle\Entity\Address",
|
||||
@@ -117,12 +148,71 @@ class ThirdParty
|
||||
*/
|
||||
private $address;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
* @ORM\Column(name="active", type="boolean", options={"defaut": true})
|
||||
*/
|
||||
private $active = true;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
* @ORM\Column(name="comment", type="text", nullable=true)
|
||||
*/
|
||||
private $comment;
|
||||
|
||||
/**
|
||||
* @var Collection
|
||||
* @ORM\ManyToMany(targetEntity="\Chill\MainBundle\Entity\Center")
|
||||
* @ORM\JoinTable(name="chill_3party.party_center")
|
||||
* @Assert\Count(min=1)
|
||||
*/
|
||||
private $centers;
|
||||
|
||||
/**
|
||||
* @var \DateTimeImmutable
|
||||
* @ORM\Column(name="created_at", type="datetime", nullable=false)
|
||||
*/
|
||||
private $createdAt;
|
||||
|
||||
/**
|
||||
* @var \DateTime
|
||||
* @ORM\Column(name="updated_at", type="datetime", nullable=true)
|
||||
*/
|
||||
private $updatedAt;
|
||||
|
||||
/**
|
||||
* @var User
|
||||
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
|
||||
* @ORM\JoinColumn(name="updated_by", referencedColumnName="id")
|
||||
*/
|
||||
private $updatedBy;
|
||||
|
||||
|
||||
/**
|
||||
* @ORM\PrePersist()
|
||||
*/
|
||||
public function prePersist()
|
||||
{
|
||||
$this->createdAt = new \DateTimeImmutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* @ORM\PreUpdate()
|
||||
*/
|
||||
public function preUpdate()
|
||||
{
|
||||
$this->updatedAt = new \DateTime();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ThirdParty constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->centers = new ArrayCollection();
|
||||
$this->categories = new ArrayCollection();
|
||||
$this->children = new ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -342,4 +432,207 @@ class ThirdParty
|
||||
{
|
||||
return $this->getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getNameCompany(): ?string
|
||||
{
|
||||
return $this->nameCompany;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $nameCompany
|
||||
* @return ThirdParty
|
||||
*/
|
||||
public function setNameCompany(string $nameCompany): ThirdParty
|
||||
{
|
||||
$this->nameCompany = $nameCompany;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAcronym(): ?string
|
||||
{
|
||||
return $this->acronym;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $acronym
|
||||
* @return $this
|
||||
*/
|
||||
public function setAcronym(string $acronym): ThirdParty
|
||||
{
|
||||
$this->acronym = $acronym;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
public function getCategories(): Collection
|
||||
{
|
||||
return $this->categories;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ThirdPartyCategory $category
|
||||
* @return $this
|
||||
*/
|
||||
public function addCategory(ThirdPartyCategory $category): self
|
||||
{
|
||||
$this->categories[] = $category;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ThirdPartyCategory $category
|
||||
* @return $this
|
||||
*/
|
||||
public function removeCategory(ThirdPartyCategory $category): self
|
||||
{
|
||||
$this->categories->removeElement($category);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
public function getChildren(): Collection
|
||||
{
|
||||
return $this->children;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ThirdParty $child
|
||||
* @return $this
|
||||
*/
|
||||
public function addChild(ThirdParty $child): self
|
||||
{
|
||||
$this->children[] = $child;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ThirdParty $child
|
||||
* @return $this
|
||||
*/
|
||||
public function removeChild(ThirdParty $child): self
|
||||
{
|
||||
$this->categories->removeElement($child);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ThirdParty
|
||||
*/
|
||||
public function getParent(): ThirdParty
|
||||
{
|
||||
return $this->parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ThirdParty $parent
|
||||
* @return $this
|
||||
*/
|
||||
public function setParent(ThirdParty $parent): ThirdParty
|
||||
{
|
||||
$this->parent = $parent;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ThirdPartyCivility|null
|
||||
*/
|
||||
public function getCivility(): ?ThirdPartyCivility
|
||||
{
|
||||
return $this->civility;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ThirdPartyCivility $civility
|
||||
* @return $this
|
||||
*/
|
||||
public function setCivility(ThirdPartyCivility $civility): ThirdParty
|
||||
{
|
||||
$this->civility = $civility;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ThirdPartyProfession
|
||||
*/
|
||||
public function getProfession(): ?ThirdPartyProfession
|
||||
{
|
||||
return $this->profession;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ThirdPartyProfession $profession
|
||||
* @return $this
|
||||
*/
|
||||
public function setProfession(ThirdPartyProfession $profession): ThirdParty
|
||||
{
|
||||
$this->profession = $profession;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DateTimeImmutable
|
||||
*/
|
||||
public function getCreatedAt(): \DateTimeImmutable
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \DateTimeImmutable $createdAt
|
||||
* @return $this
|
||||
*/
|
||||
public function setCreatedAt(\DateTimeImmutable $createdAt): ThirdParty
|
||||
{
|
||||
$this->createdAt = $createdAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getUpdatedAt(): \DateTime
|
||||
{
|
||||
return $this->updatedAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \DateTime $updatedAt
|
||||
* @return $this
|
||||
*/
|
||||
public function setUpdatedAt(\DateTime $updatedAt): ThirdParty
|
||||
{
|
||||
$this->updatedAt = $updatedAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return User
|
||||
*/
|
||||
public function getUpdatedBy(): User
|
||||
{
|
||||
return $this->updatedBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $updatedBy
|
||||
* @return $this
|
||||
*/
|
||||
public function setUpdatedBy(User $updatedBy): ThirdParty
|
||||
{
|
||||
$this->updatedBy = $updatedBy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user