<?php
/**
* Created by PhpStorm.
* User: sbrun
* Date: 2018-03-16
* Time: 15:05
*/
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Serializer\Annotation\MaxDepth;
/**
* @ORM\Entity
* @ORM\Table(name="laralivre_company")
* @ORM\Entity(repositoryClass="App\Repository\CompanyRepository")
* @Vich\Uploadable
*/
class Company
{
const ID_REPENTIGNY = 1;
const ID_VERSAILLES = 3;
const ID_ST_HUBERT = 4;
const ID_ENTREPOT = 5;
const ID_COLLECTIVITE = 6;
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(name="company_name", type="string", length=150)
*/
protected $name;
/**
* @ORM\Column(name="company_address", type="string", length=150)
*/
protected $address;
/**
* @ORM\Column(name="company_country", type="string", length=100)
*/
protected $country;
/**
* @ORM\Column(name="company_telephone", type="string", length=25)
*/
protected $telephone;
/**
* @ORM\Column(name="company_active", type="boolean")
*/
protected $active;
/**
* @ORM\Column(name="company_city", type="string", length=75)
*/
protected $city;
/**
* @ORM\Column(name="company_zipcode", type="string", length=10)
*/
protected $zipcode;
/**
* @ORM\Column(name="company_province", type="string", length=25)
*/
protected $province;
/**
* @ORM\Column(name="company_timezone", type="string", length=25, nullable=true)
*/
protected $timezone;
/**
* @ORM\Column(name="company", type="integer")
*/
protected $company;
/**
* NOTE: This is not a mapped field of entity metadata, just a simple property.
*
* Pour les contraintes:
* https://symfony.com/doc/3.4/reference/constraints/Image.html
*
* @Vich\UploadableField(mapping="company_logo", fileNameProperty="logo1")
*
* @var File
*/
private $logo1File;
/**
* @ORM\Column(name="company_logo1", type="string", length=75, nullable=true)
*/
protected $logo1;
/**
* @ORM\Column(name="company_logo2", type="string", length=75, nullable=true)
*/
protected $logo2;
/**
* @ORM\Column(name="company_maxuser", type="integer")
*/
protected $maxuser;
/**
* @ORM\Column(name="company_session_timeout", type="integer")
*/
protected $sessionTimeout;
/**
* @ORM\Column(name="company_inventaire", type="boolean")
*/
protected $inventaire;
/**
* @ORM\Column(type="datetime")
*
* @var \DateTime
*/
private $updatedAt;
/**
* @ORM\OneToMany(targetEntity="SysUsers", mappedBy="company", indexBy="company")
* @MaxDepth(1)
*/
protected $sysUsers;
/**
* @ORM\Column(name="company_mail", type="string", length=255, nullable=true)
* @MaxDepth(1)
*/
protected $mail;
/**
* has many Collections
*
* @ORM\OneToMany(targetEntity="App\Entity\Collections", mappedBy="company")
* @MaxDepth(1)
*/
protected $collections;
/**
* has many Collections
*
* @ORM\OneToMany(targetEntity="App\Entity\Departements", mappedBy="company")
*/
protected $departements;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Factures", mappedBy="succursale")
* @MaxDepth(1)
*/
protected $factures;
/**
* One product has many features. This is the inverse side.
* @ORM\OneToMany(targetEntity="TitreCompany", mappedBy="company")
*/
private $titresCompany;
public function __construct()
{
$this->collections = new ArrayCollection();
}
/**
* @return mixed
*/
public function getCollections()
{
return $this->collections;
}
/**
* @param ArrayCollection $collections
*/
public function setCollections(ArrayCollection $collections)
{
$this->collections = $collections;
}
/**
* @param Collections $collection
*/
public function addCollection(Collections $collection)
{
$this->collections->add($collection);
}
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @param mixed $name
*/
public function setId($id)
{
$this->id = $id;
}
/**
* @return mixed
*/
public function getName()
{
return $this->name;
}
/**
* @param mixed $name
*/
public function setName($name)
{
$this->name = $name;
}
/**
* @return mixed
*/
public function getAddress()
{
return $this->address;
}
/**
* @param mixed $address
*/
public function setAddress($address)
{
$this->address = $address;
}
/**
* @return mixed
*/
public function getCountry()
{
return $this->country;
}
/**
* @param mixed $country
*/
public function setCountry($country)
{
$this->country = $country;
}
/**
* @return mixed
*/
public function getTelephone()
{
return $this->telephone;
}
/**
* @param mixed $telephone
*/
public function setTelephone($telephone)
{
$this->telephone = $telephone;
}
/**
* @return mixed
*/
public function getActive()
{
return $this->active;
}
/**
* @param mixed $active
*/
public function setActive($active)
{
$this->active = $active;
}
/**
* @return mixed
*/
public function getCity()
{
return $this->city;
}
/**
* @param mixed $city
*/
public function setCity($city)
{
$this->city = $city;
}
/**
* @return mixed
*/
public function getZipcode()
{
return $this->zipcode;
}
/**
* @param mixed $zipcode
*/
public function setZipcode($zipcode)
{
$this->zipcode = $zipcode;
}
/**
* @return mixed
*/
public function getProvince()
{
return $this->province;
}
/**
* @param mixed $province
*/
public function setProvince($province)
{
$this->province = $province;
}
/**
* @return mixed
*/
public function getTimezone()
{
return $this->timezone;
}
/**
* @param mixed $timezone
*/
public function setTimezone($timezone)
{
$this->timezone = $timezone;
}
/**
* @return mixed
*/
public function getCompany()
{
return $this->company;
}
/**
* @param mixed $company
*/
public function setCompany($company)
{
$this->company = $company;
}
/**
* If manually uploading a file (i.e. not using Symfony Form) ensure an instance
* of 'UploadedFile' is injected into this setter to trigger the update. If this
* bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
* must be able to accept an instance of 'File' as the bundle will inject one here
* during Doctrine hydration.
*
* @param File|\Symfony\Component\HttpFoundation\File\UploadedFile $image
* @throws \Exception
*/
public function setLogo1File(File $image = null)
{
$this->logo1File = $image;
if (null !== $image) {
// It is required that at least one field changes if you are using doctrine
// otherwise the event listeners won't be called and the file is lost
$this->updatedAt = new \DateTimeImmutable();
}
}
public function getLogo1File()
{
return $this->logo1File;
}
/**
* @return mixed
*/
public function getLogo1()
{
return $this->logo1;
}
/**
* @param mixed $logo1
* @return Company
*/
public function setLogo1($logo1)
{
$this->logo1 = $logo1;
return $this;
}
/**
* @return mixed
*/
public function getLogo2()
{
return $this->logo2;
}
/**
* @param mixed $logo2
*/
public function setLogo2($logo2)
{
$this->logo2 = $logo2;
}
/**
* @return mixed
*/
public function getMaxuser()
{
return $this->maxuser;
}
/**
* @param mixed $maxuser
*/
public function setMaxuser($maxuser)
{
$this->maxuser = $maxuser;
}
/**
* @return mixed
*/
public function getSessionTimeout()
{
return $this->sessionTimeout;
}
/**
* @param mixed $sessionTimeout
*/
public function setSessionTimeout($sessionTimeout)
{
$this->sessionTimeout = $sessionTimeout;
}
/**
* @return \DateTime
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
/**
* @param \DateTime $updatedAt
*/
public function setUpdatedAt($updatedAt)
{
$this->updatedAt = $updatedAt;
}
/**
* @return array
*/
public function getFactures()
{
return $this->factures;
}
/**
* @param array $factures
*/
public function setFactures($factures)
{
$this->factures = $factures;
}
public function __toString()
{
return (string)$this->getId();
}
/**
* @return mixed
*/
public function getInventaire()
{
return $this->inventaire;
}
/**
* @param mixed $inventaire
*/
public function setInventaire($inventaire)
{
$this->inventaire = $inventaire;
}
/**
* @return mixed
*/
public function getMail()
{
return $this->mail;
}
/**
* @param mixed $mail
*/
public function setMail($mail)
{
$this->mail = $mail;
}
/**
* @return mixed
*/
public function getTitresCompany()
{
return $this->titresCompany;
}
/**
* @param mixed $titresCompany
*/
public function setTitresCompany($titresCompany): void
{
$this->titresCompany = $titresCompany;
}
}