<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\OrganizationRepository")
* @ORM\Table(indexes={
* @ORM\Index(name="description",columns={"description"}),
* @ORM\Index(name="name",columns={"name"}),
* @ORM\Index(name="createdAt",columns={"created_at"}),
* @ORM\Index(name="updatedAt",columns={"updated_at"}),
* @ORM\Index(name="deletedAt",columns={"deleted_at"}),
* @ORM\Index(name="created",columns={"created"}),
* })
* @ORM\HasLifecycleCallbacks
*/
class Organization {
const TYPE_COMPANY = 'TYPE_COMPANY';
const TYPE_ENTITY = 'TYPE_ENTITY';
/*List Type*/
const TYPE_BLACK_LIST = 'TYPE_BLACK_LIST';
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\Column(type="string", length=255)
*/
private $type;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $description;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $logo;
/**
* @ORM\ManyToOne(targetEntity="UserType")
* @ORM\JoinColumn(name="user_type_id", referencedColumnName="id",nullable=true)
*/
protected $userType;
/**
* @ORM\OneToMany(targetEntity="User", mappedBy="organization")
*/
private $users;
/**
* @ORM\OneToMany(targetEntity="Animal", mappedBy="organization")
*/
private $animals;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $created;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $cuit;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $email;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $phone;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $businessName;
/**
* @ORM\ManyToOne(targetEntity="Address", cascade={"persist"})
* @ORM\JoinColumn(name="address_id", referencedColumnName="id")
*/
private $address;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $listType;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $activity;
/**
* @ORM\Column(type="datetime")
*/
private $createdAt;
/**
* @ORM\Column(type="datetime")
*/
private $updatedAt;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $deletedAt;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isProducer;
/** @ORM\PreUpdate */
public function PreUpdate()
{
$this->setUpdatedAt( new \DateTime() );
}
/** @ORM\PrePersist */
public function PrePersist()
{
$this->setCreatedAt( new \DateTime() );
$this->setUpdatedAt( new \DateTime() );
}
public function __toString() {
return $this->name;
}
public function __construct() {
$this->created = new \DateTime('now');
$this->users = new ArrayCollection();
$this->animals = new ArrayCollection();
$this->setType(Organization::TYPE_COMPANY);
}
public function getId(): ?int {
return $this->id;
}
public function setId($id) {
$this->id = $id;
}
public function getName(): ?string {
return $this->name;
}
public function setName(string $name): self {
$this->name = $name;
return $this;
}
public function getDescription(): ?string {
return $this->description;
}
public function setDescription(?string $description): self {
$this->description = $description;
return $this;
}
public function getCreated(): ?\DateTimeInterface {
return $this->created;
}
public function setCreated(\DateTimeInterface $created): self {
$this->created = $created;
return $this;
}
public function getType(): ?string {
return $this->type;
}
public function setType(string $type): self {
$this->type = $type;
return $this;
}
/**
* @return Collection|User[]
*/
public function getUsers(): Collection {
return $this->users;
}
public function addUser(User $user): self {
if (!$this->users->contains($user)) {
$this->users[] = $user;
$user->setOrganization($this);
}
return $this;
}
public function removeUser(User $user): self {
if ($this->users->contains($user)) {
$this->users->removeElement($user);
// set the owning side to null (unless already changed)
if ($user->getOrganization() === $this) {
$user->setOrganization(null);
}
}
return $this;
}
/**
* @return Collection|Animal[]
*/
public function getAnimals(): Collection {
return $this->animals;
}
public function addAnimal(Animal $animal): self {
if (!$this->animals->contains($animal)) {
$this->animals[] = $animal;
$animal->setOrganization($this);
}
return $this;
}
public function removeAnimal(Animal $animal): self {
if ($this->animals->contains($animal)) {
$this->animals->removeElement($animal);
// set the owning side to null (unless already changed)
if ($animal->getOrganization() === $this) {
$animal->setOrganization(null);
}
}
return $this;
}
public function getLogo(): ?string {
return $this->logo;
}
public function setLogo(?string $logo): self {
$this->logo = $logo;
return $this;
}
/**
* @return mixed
*/
public function getUserType() {
return $this->userType;
}
/**
* @param mixed $userType
*/
public function setUserType($userType): void {
$this->userType = $userType;
}
/**
* @return mixed
*/
public function getCuit()
{
return $this->cuit;
}
/**
* @param mixed $cuit
*/
public function setCuit($cuit)
{
$this->cuit = $cuit;
}
/**
* @return mixed
*/
public function getEmail()
{
return $this->email;
}
/**
* @param mixed $email
*/
public function setEmail($email)
{
$this->email = $email;
}
/**
* @return mixed
*/
public function getPhone()
{
return $this->phone;
}
/**
* @param mixed $phone
*/
public function setPhone($phone)
{
$this->phone = $phone;
}
/**
* @return mixed
*/
public function getBusinessName()
{
return $this->businessName;
}
/**
* @param mixed $businessName
*/
public function setBusinessName($businessName): void
{
$this->businessName = $businessName;
}
/**
* @return mixed
*/
public function getAddress()
{
return $this->address;
}
/**
* @param mixed $address
*/
public function setAddress($address): void
{
$this->address = $address;
}
public function getListType(): ?string
{
return $this->listType;
}
public function setListType(string $listType): self
{
$this->listType = $listType;
return $this;
}
public function getActivity(): ?string
{
return $this->activity;
}
public function setActivity(?string $activity): self
{
$this->activity = $activity;
return $this;
}
public function getCreatedAt(): ?\DateTime
{
return $this->createdAt;
}
public function setCreatedAt(\DateTime $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getUpdatedAt(): ?\DateTime
{
return $this->updatedAt;
}
public function setUpdatedAt(\DateTime $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
public function getDeletedAt(): ?\DateTime
{
return $this->deletedAt;
}
public function setDeletedAt(?\DateTime $deletedAt): self
{
$this->deletedAt = $deletedAt;
return $this;
}
public function isIsProducer(): ?bool
{
return $this->isProducer;
}
public function setIsProducer(bool $isProducer): self
{
$this->isProducer = $isProducer;
return $this;
}
}