mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-04 13:54:59 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -18,7 +18,6 @@ use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
|
||||
use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait;
|
||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||
use DateTime;
|
||||
use DateTimeInterface;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
@@ -29,7 +28,9 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
* Address.
|
||||
*
|
||||
* @ORM\Entity
|
||||
*
|
||||
* @ORM\Table(name="chill_main_address")
|
||||
*
|
||||
* @ORM\HasLifecycleCallbacks
|
||||
*/
|
||||
class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
@@ -38,68 +39,76 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
use TrackUpdateTrait;
|
||||
|
||||
/**
|
||||
* When an Address does match with the AddressReference
|
||||
* When an Address does match with the AddressReference.
|
||||
*/
|
||||
final public const ADDR_REFERENCE_STATUS_MATCH = 'match';
|
||||
|
||||
/**
|
||||
* When an Address does not match with the AddressReference, and
|
||||
* is pending for a review
|
||||
* is pending for a review.
|
||||
*/
|
||||
final public const ADDR_REFERENCE_STATUS_TO_REVIEW = 'to_review';
|
||||
|
||||
/**
|
||||
* When an Address does not match with the AddressReference, but
|
||||
* is reviewed
|
||||
* is reviewed.
|
||||
*/
|
||||
final public const ADDR_REFERENCE_STATUS_REVIEWED = 'reviewed';
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=AddressReference::class)
|
||||
*
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
private ?AddressReference $addressReference = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
*
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
private string $buildingName = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="boolean", options={"default": false})
|
||||
*
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
private bool $confidential = false;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
*
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
private string $corridor = '';
|
||||
|
||||
/**
|
||||
* used for the CEDEX information
|
||||
* used for the CEDEX information.
|
||||
*
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
*
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
private string $distribution = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
*
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
private string $extra = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
*
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
private string $flat = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
*
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
private string $floor = '';
|
||||
@@ -111,8 +120,11 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
* on the materialized view.
|
||||
*
|
||||
* @var Collection<GeographicalUnit>
|
||||
*
|
||||
* @readonly
|
||||
*
|
||||
* @ORM\ManyToMany(targetEntity=GeographicalUnit::class)
|
||||
*
|
||||
* @ORM\JoinTable(
|
||||
* name="view_chill_main_address_geographical_unit",
|
||||
* joinColumns={@ORM\JoinColumn(name="address_id")},
|
||||
@@ -122,12 +134,14 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
private Collection $geographicalUnits;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*
|
||||
* @ORM\Id
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
*
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*
|
||||
* @Groups({"write"})
|
||||
*
|
||||
* @readonly
|
||||
*/
|
||||
private ?int $id = null;
|
||||
@@ -136,6 +150,7 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
* True if the address is a "no address", aka homeless person, ...
|
||||
*
|
||||
* @Groups({"write"})
|
||||
*
|
||||
* @ORM\Column(type="boolean", options={"default": false})
|
||||
*/
|
||||
private bool $isNoAddress = false;
|
||||
@@ -143,10 +158,10 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
/**
|
||||
* A ThirdParty reference for person's addresses that are linked to a third party.
|
||||
*
|
||||
* @var ThirdParty|null
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty")
|
||||
*
|
||||
* @Groups({"write"})
|
||||
*
|
||||
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
|
||||
*/
|
||||
private ?ThirdParty $linkedToThirdParty = null;
|
||||
@@ -154,22 +169,24 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
/**
|
||||
* A geospatial field storing the coordinates of the Address.
|
||||
*
|
||||
* @var Point|null
|
||||
*
|
||||
* @ORM\Column(type="point", nullable=true)
|
||||
*
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
private ?Point $point = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\PostalCode")
|
||||
*
|
||||
* @ORM\JoinColumn(nullable=false)
|
||||
*
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
private ?PostalCode $postcode = null;
|
||||
|
||||
/**
|
||||
* @var self::ADDR_REFERENCE_STATUS_*
|
||||
*
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": self::ADDR_REFERENCE_STATUS_MATCH})
|
||||
*/
|
||||
private string $refStatus = self::ADDR_REFERENCE_STATUS_MATCH;
|
||||
@@ -180,22 +197,22 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
private \DateTimeImmutable $refStatusLastUpdate;
|
||||
|
||||
/**
|
||||
*
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
*
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
private string $steps = '';
|
||||
|
||||
/**
|
||||
*
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
*
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
private string $street = '';
|
||||
|
||||
/**
|
||||
*
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
*
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
private string $streetNumber = '';
|
||||
@@ -205,22 +222,24 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
* of address. By default, the current date.
|
||||
*
|
||||
* @ORM\Column(type="date")
|
||||
*
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
private DateTime $validFrom;
|
||||
private \DateTime $validFrom;
|
||||
|
||||
/**
|
||||
* Indicates when the address ends. Used to build an history
|
||||
* of address.
|
||||
*
|
||||
* @ORM\Column(type="date", nullable=true)
|
||||
*
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
private ?DateTime $validTo = null;
|
||||
private ?\DateTime $validTo = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->validFrom = new DateTime();
|
||||
$this->validFrom = new \DateTime();
|
||||
$this->refStatusLastUpdate = new \DateTimeImmutable('now');
|
||||
$this->geographicalUnits = new ArrayCollection();
|
||||
}
|
||||
@@ -376,6 +395,7 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
* Get streetAddress1 (legacy function).
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
public function getStreetAddress1()
|
||||
@@ -387,6 +407,7 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
* Get streetAddress2 (legacy function).
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
public function getStreetAddress2()
|
||||
@@ -399,12 +420,12 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
return $this->streetNumber;
|
||||
}
|
||||
|
||||
public function getValidFrom(): DateTime
|
||||
public function getValidFrom(): \DateTime
|
||||
{
|
||||
return $this->validFrom;
|
||||
}
|
||||
|
||||
public function getValidTo(): ?DateTimeInterface
|
||||
public function getValidTo(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->validTo;
|
||||
}
|
||||
@@ -419,7 +440,7 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
return $this->getIsNoAddress();
|
||||
}
|
||||
|
||||
public function setAddressReference(?AddressReference $addressReference = null): Address
|
||||
public function setAddressReference(AddressReference $addressReference = null): Address
|
||||
{
|
||||
$this->addressReference = $addressReference;
|
||||
|
||||
@@ -506,11 +527,9 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
/**
|
||||
* Set postcode.
|
||||
*
|
||||
* @param PostalCode $postcode
|
||||
*
|
||||
* @return Address
|
||||
*/
|
||||
public function setPostcode(?PostalCode $postcode = null)
|
||||
public function setPostcode(PostalCode $postcode = null)
|
||||
{
|
||||
$this->postcode = $postcode;
|
||||
|
||||
@@ -518,14 +537,15 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the ref status
|
||||
* Update the ref status.
|
||||
*
|
||||
* <<<<<<< HEAD
|
||||
*
|
||||
* @param Address::ADDR_REFERENCE_STATUS_* $refStatus
|
||||
* @param bool|null $updateLastUpdate Also update the "refStatusLastUpdate"
|
||||
* =======
|
||||
* The refstatuslast update is also updated
|
||||
* >>>>>>> 31152616d (Feature: Provide api endpoint for reviewing addresses)
|
||||
* @param bool|null $updateLastUpdate Also update the "refStatusLastUpdate"
|
||||
* =======
|
||||
* The refstatuslast update is also updated
|
||||
* >>>>>>> 31152616d (Feature: Provide api endpoint for reviewing addresses)
|
||||
*/
|
||||
public function setRefStatus(string $refStatus, ?bool $updateLastUpdate = true): self
|
||||
{
|
||||
@@ -562,8 +582,6 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
/**
|
||||
* Set streetAddress1 (legacy function).
|
||||
*
|
||||
* @param string $streetAddress1
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
public function setStreetAddress1(?string $streetAddress1): self
|
||||
@@ -576,7 +594,6 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
/**
|
||||
* Set streetAddress2 (legacy function).
|
||||
*
|
||||
* @param string $streetAddress2
|
||||
* @deprecated
|
||||
*/
|
||||
public function setStreetAddress2(?string $streetAddress2): self
|
||||
@@ -596,14 +613,14 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
/**
|
||||
* @return Address
|
||||
*/
|
||||
public function setValidFrom(DateTime $validFrom)
|
||||
public function setValidFrom(\DateTime $validFrom)
|
||||
{
|
||||
$this->validFrom = $validFrom;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setValidTo(?DateTimeInterface $validTo = null): self
|
||||
public function setValidTo(\DateTimeInterface $validTo = null): self
|
||||
{
|
||||
$this->validTo = $validTo;
|
||||
|
||||
@@ -624,7 +641,7 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
*/
|
||||
public function validate(ExecutionContextInterface $context, $payload)
|
||||
{
|
||||
if (!$this->getValidFrom() instanceof DateTime) {
|
||||
if (!$this->getValidFrom() instanceof \DateTime) {
|
||||
$context
|
||||
->buildViolation('address.date-should-be-set')
|
||||
->atPath('validFrom')
|
||||
|
Reference in New Issue
Block a user