LDAP authentication support (#815)
This commit is contained in:
@@ -9,6 +9,8 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
@@ -28,7 +30,7 @@ class Activity
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var Project
|
||||
* @var Project|null
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\Project", inversedBy="activities")
|
||||
* @ORM\JoinColumn(onDelete="CASCADE")
|
||||
@@ -60,7 +62,7 @@ class Activity
|
||||
private $visible = true;
|
||||
|
||||
/**
|
||||
* @var Timesheet[]
|
||||
* @var Timesheet[]|ArrayCollection
|
||||
*
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Timesheet", mappedBy="activity")
|
||||
*/
|
||||
@@ -70,94 +72,68 @@ class Activity
|
||||
use RatesTrait;
|
||||
use ColorTrait;
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
public function __construct()
|
||||
{
|
||||
$this->timesheets = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Timesheet[]
|
||||
* @return Collection<Timesheet>
|
||||
*/
|
||||
public function getTimesheets(): array
|
||||
public function getTimesheets(): Collection
|
||||
{
|
||||
return $this->timesheets;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Project
|
||||
*/
|
||||
public function getProject()
|
||||
public function getProject(): ?Project
|
||||
{
|
||||
return $this->project;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Project $project
|
||||
* @return Activity
|
||||
*/
|
||||
public function setProject($project)
|
||||
public function setProject(?Project $project): Activity
|
||||
{
|
||||
$this->project = $project;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return Activity
|
||||
*/
|
||||
public function setName($name)
|
||||
public function setName(string $name): Activity
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
public function getName(): ?string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $comment
|
||||
* @return Activity
|
||||
*/
|
||||
public function setComment($comment)
|
||||
public function setComment(?string $comment): Activity
|
||||
{
|
||||
$this->comment = $comment;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getComment()
|
||||
public function getComment(): ?string
|
||||
{
|
||||
return $this->comment;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $visible
|
||||
* @return Activity
|
||||
*/
|
||||
public function setVisible($visible)
|
||||
public function setVisible(bool $visible): Activity
|
||||
{
|
||||
$this->visible = $visible;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getVisible()
|
||||
public function getVisible(): bool
|
||||
{
|
||||
return $this->visible;
|
||||
}
|
||||
|
||||
@@ -48,10 +48,7 @@ class Configuration
|
||||
*/
|
||||
private $value;
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
@@ -76,14 +73,17 @@ class Configuration
|
||||
}
|
||||
|
||||
/**
|
||||
* Given $value will not be serialized before its stored, so it should be a scalar type.
|
||||
* Given $value will not be serialized before its stored, so it should be a scalar type
|
||||
* that can be casted to string.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param string|null|int|bool $value
|
||||
* @return Configuration
|
||||
*/
|
||||
public function setValue($value): Configuration
|
||||
{
|
||||
$this->value = $value;
|
||||
if (null !== $value) {
|
||||
$this->value = (string) $value;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
@@ -53,7 +55,7 @@ class Customer
|
||||
private $comment;
|
||||
|
||||
/**
|
||||
* @var Project[]
|
||||
* @var Project[]|ArrayCollection
|
||||
*
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Project", mappedBy="customer")
|
||||
*/
|
||||
@@ -151,362 +153,200 @@ class Customer
|
||||
use RatesTrait;
|
||||
use ColorTrait;
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
public function __construct()
|
||||
{
|
||||
$this->projects = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
* @return Customer
|
||||
*/
|
||||
public function setName($name)
|
||||
public function setName(string $name): Customer
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName(): ?string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $number
|
||||
* @return Customer
|
||||
*/
|
||||
public function setNumber(string $number)
|
||||
public function setNumber(?string $number): Customer
|
||||
{
|
||||
$this->number = $number;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getNumber(): ?string
|
||||
{
|
||||
return $this->number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set comment
|
||||
*
|
||||
* @param string $comment
|
||||
* @return Customer
|
||||
*/
|
||||
public function setComment($comment)
|
||||
public function setComment(?string $comment): Customer
|
||||
{
|
||||
$this->comment = $comment;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get comment
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getComment()
|
||||
public function getComment(): ?string
|
||||
{
|
||||
return $this->comment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set visible
|
||||
*
|
||||
* @param bool $visible
|
||||
* @return Customer
|
||||
*/
|
||||
public function setVisible($visible)
|
||||
public function setVisible(bool $visible): Customer
|
||||
{
|
||||
$this->visible = $visible;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get visible
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getVisible()
|
||||
public function getVisible(): bool
|
||||
{
|
||||
return $this->visible;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set company
|
||||
*
|
||||
* @param string $company
|
||||
* @return Customer
|
||||
*/
|
||||
public function setCompany($company)
|
||||
public function setCompany(?string $company): Customer
|
||||
{
|
||||
$this->company = $company;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get company
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCompany()
|
||||
public function getCompany(): ?string
|
||||
{
|
||||
return $this->company;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set contact
|
||||
*
|
||||
* @param string $contact
|
||||
* @return Customer
|
||||
*/
|
||||
public function setContact($contact)
|
||||
public function setContact(?string $contact): Customer
|
||||
{
|
||||
$this->contact = $contact;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get contact
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContact()
|
||||
public function getContact(): ?string
|
||||
{
|
||||
return $this->contact;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $address
|
||||
* @return Customer
|
||||
*/
|
||||
public function setAddress($address)
|
||||
public function setAddress(?string $address): Customer
|
||||
{
|
||||
$this->address = $address;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAddress()
|
||||
public function getAddress(): ?string
|
||||
{
|
||||
return $this->address;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set country
|
||||
*
|
||||
* @param string $country
|
||||
* @return Customer
|
||||
*/
|
||||
public function setCountry($country)
|
||||
public function setCountry(string $country): Customer
|
||||
{
|
||||
$this->country = $country;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get country
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCountry()
|
||||
public function getCountry(): ?string
|
||||
{
|
||||
return $this->country;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $currency
|
||||
* @return Customer
|
||||
*/
|
||||
public function setCurrency($currency)
|
||||
public function setCurrency(string $currency): Customer
|
||||
{
|
||||
$this->currency = $currency;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCurrency()
|
||||
public function getCurrency(): string
|
||||
{
|
||||
return $this->currency;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set phone
|
||||
*
|
||||
* @param string $phone
|
||||
* @return Customer
|
||||
*/
|
||||
public function setPhone($phone)
|
||||
public function setPhone(?string $phone): Customer
|
||||
{
|
||||
$this->phone = $phone;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get phone
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPhone()
|
||||
public function getPhone(): ?string
|
||||
{
|
||||
return $this->phone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set fax
|
||||
*
|
||||
* @param string $fax
|
||||
* @return Customer
|
||||
*/
|
||||
public function setFax($fax)
|
||||
public function setFax(?string $fax): Customer
|
||||
{
|
||||
$this->fax = $fax;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get fax
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFax()
|
||||
public function getFax(): ?string
|
||||
{
|
||||
return $this->fax;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set mobile
|
||||
*
|
||||
* @param string $mobile
|
||||
* @return Customer
|
||||
*/
|
||||
public function setMobile($mobile)
|
||||
public function setMobile(?string $mobile): Customer
|
||||
{
|
||||
$this->mobile = $mobile;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get mobile
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMobile()
|
||||
public function getMobile(): ?string
|
||||
{
|
||||
return $this->mobile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set mail
|
||||
*
|
||||
* @param string $mail
|
||||
* @return Customer
|
||||
*/
|
||||
public function setEmail($mail)
|
||||
public function setEmail(?string $mail): Customer
|
||||
{
|
||||
$this->email = $mail;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get mail
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEmail()
|
||||
public function getEmail(): ?string
|
||||
{
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set homepage
|
||||
*
|
||||
* @param string $homepage
|
||||
* @return Customer
|
||||
*/
|
||||
public function setHomepage($homepage)
|
||||
public function setHomepage(?string $homepage): Customer
|
||||
{
|
||||
$this->homepage = $homepage;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get homepage
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHomepage()
|
||||
public function getHomepage(): ?string
|
||||
{
|
||||
return $this->homepage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set timezone
|
||||
*
|
||||
* @param string $timezone
|
||||
* @return Customer
|
||||
*/
|
||||
public function setTimezone($timezone)
|
||||
public function setTimezone(string $timezone): Customer
|
||||
{
|
||||
$this->timezone = $timezone;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get timezone
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTimezone()
|
||||
public function getTimezone(): ?string
|
||||
{
|
||||
return $this->timezone;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Project[] $projects
|
||||
* @return Customer
|
||||
* @return Collection<Project>
|
||||
*/
|
||||
public function setProjects($projects)
|
||||
{
|
||||
$this->projects = $projects;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Project[]
|
||||
*/
|
||||
public function getProjects()
|
||||
public function getProjects(): Collection
|
||||
{
|
||||
return $this->projects;
|
||||
}
|
||||
|
||||
@@ -109,202 +109,125 @@ class InvoiceTemplate
|
||||
*/
|
||||
private $paymentTerms;
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
* @return $this
|
||||
*/
|
||||
public function setName($name)
|
||||
public function setName(string $name): InvoiceTemplate
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
public function getName(): ?string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle(): ?string
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $title
|
||||
* @return InvoiceTemplate
|
||||
*/
|
||||
public function setTitle(string $title)
|
||||
public function setTitle(string $title): InvoiceTemplate
|
||||
{
|
||||
$this->title = $title;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAddress(): ?string
|
||||
{
|
||||
return $this->address;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $address
|
||||
* @return InvoiceTemplate
|
||||
*/
|
||||
public function setAddress($address)
|
||||
public function setAddress(?string $address): InvoiceTemplate
|
||||
{
|
||||
$this->address = $address;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getNumberGenerator(): ?string
|
||||
public function getNumberGenerator(): string
|
||||
{
|
||||
return $this->numberGenerator;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $numberGenerator
|
||||
* @return InvoiceTemplate
|
||||
*/
|
||||
public function setNumberGenerator(string $numberGenerator)
|
||||
public function setNumberGenerator(string $numberGenerator): InvoiceTemplate
|
||||
{
|
||||
$this->numberGenerator = $numberGenerator;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getDueDays(): ?int
|
||||
public function getDueDays(): int
|
||||
{
|
||||
return $this->dueDays;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $dueDays
|
||||
* @return InvoiceTemplate
|
||||
*/
|
||||
public function setDueDays(int $dueDays)
|
||||
public function setDueDays(int $dueDays): InvoiceTemplate
|
||||
{
|
||||
$this->dueDays = $dueDays;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
public function getVat(): ?float
|
||||
public function getVat(): float
|
||||
{
|
||||
return $this->vat;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $vat
|
||||
* @return InvoiceTemplate
|
||||
*/
|
||||
public function setVat(float $vat)
|
||||
public function setVat(float $vat): InvoiceTemplate
|
||||
{
|
||||
$this->vat = $vat;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCompany(): ?string
|
||||
{
|
||||
return $this->company;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $company
|
||||
* @return InvoiceTemplate
|
||||
*/
|
||||
public function setCompany(string $company)
|
||||
public function setCompany(string $company): InvoiceTemplate
|
||||
{
|
||||
$this->company = $company;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getRenderer(): string
|
||||
{
|
||||
return $this->renderer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $renderer
|
||||
* @return InvoiceTemplate
|
||||
*/
|
||||
public function setRenderer(string $renderer)
|
||||
public function setRenderer(string $renderer): InvoiceTemplate
|
||||
{
|
||||
$this->renderer = $renderer;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCalculator(): string
|
||||
{
|
||||
return $this->calculator;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $calculator
|
||||
* @return InvoiceTemplate
|
||||
*/
|
||||
public function setCalculator(string $calculator)
|
||||
public function setCalculator(string $calculator): InvoiceTemplate
|
||||
{
|
||||
$this->calculator = $calculator;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPaymentTerms(): ?string
|
||||
{
|
||||
return $this->paymentTerms;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $paymentTerms
|
||||
* @return InvoiceTemplate
|
||||
*/
|
||||
public function setPaymentTerms(?string $paymentTerms)
|
||||
public function setPaymentTerms(?string $paymentTerms): InvoiceTemplate
|
||||
{
|
||||
$this->paymentTerms = $paymentTerms;
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
@@ -77,7 +79,7 @@ class Project
|
||||
private $budget = 0.00;
|
||||
|
||||
/**
|
||||
* @var Activity[]
|
||||
* @var Activity[]|ArrayCollection
|
||||
*
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Activity", mappedBy="project")
|
||||
*/
|
||||
@@ -88,54 +90,43 @@ class Project
|
||||
use ColorTrait;
|
||||
|
||||
/**
|
||||
* @var Timesheet[]
|
||||
* @var Timesheet[]|ArrayCollection
|
||||
*
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Timesheet", mappedBy="project")
|
||||
*/
|
||||
private $timesheets;
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
public function __construct()
|
||||
{
|
||||
$this->activities = new ArrayCollection();
|
||||
$this->timesheets = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Customer
|
||||
*/
|
||||
public function getCustomer()
|
||||
public function getCustomer(): ?Customer
|
||||
{
|
||||
return $this->customer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Customer $customer
|
||||
* @return Project
|
||||
*/
|
||||
public function setCustomer($customer)
|
||||
public function setCustomer(Customer $customer): Project
|
||||
{
|
||||
$this->customer = $customer;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return Project
|
||||
*/
|
||||
public function setName($name)
|
||||
public function setName(string $name): Project
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
public function getName(): ?string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
@@ -144,26 +135,19 @@ class Project
|
||||
* @param string $comment
|
||||
* @return Project
|
||||
*/
|
||||
public function setComment($comment)
|
||||
public function setComment($comment): Project
|
||||
{
|
||||
$this->comment = $comment;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getComment()
|
||||
public function getComment(): ?string
|
||||
{
|
||||
return $this->comment;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $visible
|
||||
* @return Project
|
||||
*/
|
||||
public function setVisible($visible)
|
||||
public function setVisible(bool $visible): Project
|
||||
{
|
||||
$this->visible = $visible;
|
||||
|
||||
@@ -173,7 +157,7 @@ class Project
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getVisible()
|
||||
public function getVisible(): bool
|
||||
{
|
||||
return $this->visible;
|
||||
}
|
||||
@@ -182,7 +166,7 @@ class Project
|
||||
* @param float $budget
|
||||
* @return Project
|
||||
*/
|
||||
public function setBudget($budget)
|
||||
public function setBudget($budget): Project
|
||||
{
|
||||
$this->budget = $budget;
|
||||
|
||||
@@ -198,39 +182,17 @@ class Project
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Timesheet[] $timesheets
|
||||
* @return Project
|
||||
* @return Collection<Timesheet>
|
||||
*/
|
||||
public function setTimesheets($timesheets)
|
||||
{
|
||||
$this->timesheets = $timesheets;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Timesheet[]
|
||||
*/
|
||||
public function getTimesheets()
|
||||
public function getTimesheets(): Collection
|
||||
{
|
||||
return $this->timesheets;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Activity[] $activities
|
||||
* @return Project
|
||||
* @return Collection<Activity>
|
||||
*/
|
||||
public function setActivities($activities)
|
||||
{
|
||||
$this->activities = $activities;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Activity[]
|
||||
*/
|
||||
public function getActivities()
|
||||
public function getActivities(): Collection
|
||||
{
|
||||
return $this->activities;
|
||||
}
|
||||
@@ -247,7 +209,7 @@ class Project
|
||||
* @param string $orderNumber
|
||||
* @return Project
|
||||
*/
|
||||
public function setOrderNumber($orderNumber)
|
||||
public function setOrderNumber($orderNumber): Project
|
||||
{
|
||||
$this->orderNumber = $orderNumber;
|
||||
|
||||
|
||||
@@ -55,36 +55,23 @@ class Tag
|
||||
$this->timesheets = new ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $tagName
|
||||
* @return Tag
|
||||
*/
|
||||
public function setName($tagName)
|
||||
public function setName(string $tagName): Tag
|
||||
{
|
||||
$this->name = $tagName;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
public function getName(): ?string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Timesheet $timesheet
|
||||
*/
|
||||
public function addTimesheet(Timesheet $timesheet)
|
||||
{
|
||||
if ($this->timesheets->contains($timesheet)) {
|
||||
@@ -95,9 +82,6 @@ class Tag
|
||||
$timesheet->addTag($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Timesheet $timesheet
|
||||
*/
|
||||
public function removeTimesheet(Timesheet $timesheet)
|
||||
{
|
||||
if (!$this->timesheets->contains($timesheet)) {
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
@@ -148,11 +149,11 @@ class Timesheet
|
||||
}
|
||||
|
||||
/**
|
||||
* Get entry id
|
||||
* Get entry id, returns null for new entities which were not persisted.
|
||||
*
|
||||
* @return int
|
||||
* @return int|null
|
||||
*/
|
||||
public function getId()
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
@@ -178,10 +179,7 @@ class Timesheet
|
||||
$this->localized = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getBegin()
|
||||
public function getBegin(): ?\DateTime
|
||||
{
|
||||
$this->localizeDates();
|
||||
|
||||
@@ -192,7 +190,7 @@ class Timesheet
|
||||
* @param \DateTime $begin
|
||||
* @return Timesheet
|
||||
*/
|
||||
public function setBegin(\DateTime $begin)
|
||||
public function setBegin(\DateTime $begin): Timesheet
|
||||
{
|
||||
$this->begin = $begin;
|
||||
$this->timezone = $begin->getTimezone()->getName();
|
||||
@@ -200,10 +198,7 @@ class Timesheet
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DateTime|null
|
||||
*/
|
||||
public function getEnd()
|
||||
public function getEnd(): ?\DateTime
|
||||
{
|
||||
$this->localizeDates();
|
||||
|
||||
@@ -214,7 +209,7 @@ class Timesheet
|
||||
* @param \DateTime $end
|
||||
* @return Timesheet
|
||||
*/
|
||||
public function setEnd(?\DateTime $end)
|
||||
public function setEnd(?\DateTime $end): Timesheet
|
||||
{
|
||||
$this->end = $end;
|
||||
|
||||
@@ -232,7 +227,7 @@ class Timesheet
|
||||
* @param int $duration
|
||||
* @return Timesheet
|
||||
*/
|
||||
public function setDuration($duration)
|
||||
public function setDuration($duration): Timesheet
|
||||
{
|
||||
$this->duration = $duration;
|
||||
|
||||
@@ -253,17 +248,14 @@ class Timesheet
|
||||
* @param User $user
|
||||
* @return Timesheet
|
||||
*/
|
||||
public function setUser(User $user)
|
||||
public function setUser(User $user): Timesheet
|
||||
{
|
||||
$this->user = $user;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return User
|
||||
*/
|
||||
public function getUser()
|
||||
public function getUser(): ?User
|
||||
{
|
||||
return $this->user;
|
||||
}
|
||||
@@ -272,25 +264,19 @@ class Timesheet
|
||||
* @param Activity $activity
|
||||
* @return Timesheet
|
||||
*/
|
||||
public function setActivity($activity)
|
||||
public function setActivity($activity): Timesheet
|
||||
{
|
||||
$this->activity = $activity;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Activity
|
||||
*/
|
||||
public function getActivity()
|
||||
public function getActivity(): ?Activity
|
||||
{
|
||||
return $this->activity;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Project
|
||||
*/
|
||||
public function getProject()
|
||||
public function getProject(): ?Project
|
||||
{
|
||||
return $this->project;
|
||||
}
|
||||
@@ -299,7 +285,7 @@ class Timesheet
|
||||
* @param Project $project
|
||||
* @return Timesheet
|
||||
*/
|
||||
public function setProject(Project $project)
|
||||
public function setProject(Project $project): Timesheet
|
||||
{
|
||||
$this->project = $project;
|
||||
|
||||
@@ -310,17 +296,14 @@ class Timesheet
|
||||
* @param string $description
|
||||
* @return Timesheet
|
||||
*/
|
||||
public function setDescription($description)
|
||||
public function setDescription($description): Timesheet
|
||||
{
|
||||
$this->description = $description;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription()
|
||||
public function getDescription(): ?string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
@@ -329,7 +312,7 @@ class Timesheet
|
||||
* @param float $rate
|
||||
* @return Timesheet
|
||||
*/
|
||||
public function setRate($rate)
|
||||
public function setRate($rate): Timesheet
|
||||
{
|
||||
$this->rate = $rate;
|
||||
|
||||
@@ -348,7 +331,7 @@ class Timesheet
|
||||
* @param Tag $tag
|
||||
* @return Timesheet
|
||||
*/
|
||||
public function addTag(Tag $tag)
|
||||
public function addTag(Tag $tag): Timesheet
|
||||
{
|
||||
if ($this->tags->contains($tag)) {
|
||||
return $this;
|
||||
@@ -372,9 +355,9 @@ class Timesheet
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Tag[]|ArrayCollection
|
||||
* @return Collection<Tag>
|
||||
*/
|
||||
public function getTags()
|
||||
public function getTags(): Collection
|
||||
{
|
||||
return $this->tags;
|
||||
}
|
||||
@@ -404,7 +387,7 @@ class Timesheet
|
||||
* @param bool $exported
|
||||
* @return Timesheet
|
||||
*/
|
||||
public function setExported(bool $exported)
|
||||
public function setExported(bool $exported): Timesheet
|
||||
{
|
||||
$this->exported = $exported;
|
||||
|
||||
@@ -426,7 +409,7 @@ class Timesheet
|
||||
* @param string $timezone
|
||||
* @return Timesheet
|
||||
*/
|
||||
public function setTimezone(string $timezone)
|
||||
public function setTimezone(string $timezone): Timesheet
|
||||
{
|
||||
$this->timezone = $timezone;
|
||||
|
||||
|
||||
@@ -105,122 +105,77 @@ class User extends BaseUser implements UserInterface
|
||||
$this->preferences = new ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getRegisteredAt()
|
||||
public function getRegisteredAt(): ?\DateTime
|
||||
{
|
||||
return $this->registeredAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \DateTime $registeredAt
|
||||
* @return $this
|
||||
*/
|
||||
public function setRegisteredAt(\DateTime $registeredAt)
|
||||
public function setRegisteredAt(\DateTime $registeredAt): User
|
||||
{
|
||||
$this->registeredAt = $registeredAt;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $alias
|
||||
* @return $this
|
||||
*/
|
||||
public function setAlias($alias)
|
||||
public function setAlias(?string $alias): User
|
||||
{
|
||||
$this->alias = $alias;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAlias()
|
||||
public function getAlias(): ?string
|
||||
{
|
||||
return $this->alias;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
public function getTitle(): ?string
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $title
|
||||
* @return $this
|
||||
*/
|
||||
public function setTitle($title)
|
||||
public function setTitle(?string $title): User
|
||||
{
|
||||
$this->title = $title;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAvatar()
|
||||
public function getAvatar(): ?string
|
||||
{
|
||||
return $this->avatar;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $avatar
|
||||
* @return $this
|
||||
*/
|
||||
public function setAvatar($avatar)
|
||||
public function setAvatar(?string $avatar): User
|
||||
{
|
||||
$this->avatar = $avatar;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getApiToken()
|
||||
public function getApiToken(): ?string
|
||||
{
|
||||
return $this->apiToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $apiToken
|
||||
* @return User
|
||||
*/
|
||||
public function setApiToken($apiToken)
|
||||
public function setApiToken(?string $apiToken): User
|
||||
{
|
||||
$this->apiToken = $apiToken;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPlainApiToken(): ?string
|
||||
{
|
||||
return $this->plainApiToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $plainApiToken
|
||||
* @return User
|
||||
*/
|
||||
public function setPlainApiToken(string $plainApiToken)
|
||||
public function setPlainApiToken(?string $plainApiToken): User
|
||||
{
|
||||
$this->plainApiToken = $plainApiToken;
|
||||
|
||||
@@ -228,7 +183,7 @@ class User extends BaseUser implements UserInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @return UserPreference[]|Collection
|
||||
* @return Collection<UserPreference>
|
||||
*/
|
||||
public function getPreferences(): Collection
|
||||
{
|
||||
@@ -236,10 +191,10 @@ class User extends BaseUser implements UserInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param UserPreference[]|Collection<UserPreference> $preferences
|
||||
* @param iterable<UserPreference> $preferences
|
||||
* @return User
|
||||
*/
|
||||
public function setPreferences($preferences)
|
||||
public function setPreferences(iterable $preferences): User
|
||||
{
|
||||
$this->preferences = new ArrayCollection();
|
||||
|
||||
@@ -252,10 +207,29 @@ class User extends BaseUser implements UserInterface
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return UserPreference|null
|
||||
* @param bool|int|string|null $value
|
||||
*/
|
||||
public function getPreference(string $name)
|
||||
public function setPreferenceValue(string $name, $value = null)
|
||||
{
|
||||
$pref = $this->getPreference($name);
|
||||
|
||||
if (null === $pref) {
|
||||
$pref = new UserPreference();
|
||||
$pref->setName($name);
|
||||
$this->addPreference($pref);
|
||||
}
|
||||
|
||||
$pref->setValue($value);
|
||||
}
|
||||
|
||||
public function getPreference(string $name): ?UserPreference
|
||||
{
|
||||
// this code will be triggered, if a currently logged-in user will be deleted and the refreshed from the session
|
||||
// via one of the UserProvider - e.g. see LdapUserProvider::refreshUser() which calls $user->getPreferenceValue()
|
||||
if (empty($this->preferences)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
foreach ($this->preferences as $preference) {
|
||||
if ($preference->getName() == $name) {
|
||||
return $preference;
|
||||
@@ -268,7 +242,7 @@ class User extends BaseUser implements UserInterface
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLocale()
|
||||
public function getLocale(): string
|
||||
{
|
||||
return $this->getPreferenceValue(UserPreference::LOCALE, User::DEFAULT_LANGUAGE);
|
||||
}
|
||||
@@ -292,7 +266,7 @@ class User extends BaseUser implements UserInterface
|
||||
* @param UserPreference $preference
|
||||
* @return User
|
||||
*/
|
||||
public function addPreference(UserPreference $preference)
|
||||
public function addPreference(UserPreference $preference): User
|
||||
{
|
||||
$this->preferences->add($preference);
|
||||
$preference->setUser($this);
|
||||
|
||||
Reference in New Issue
Block a user