mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
DX: [Address] fix inconsistencies between doctrine mapping and sql schema
DX: [Address] fix inconsistencies between doctrine mapping and sql schema Fixed: Address vue module do now set empty value to empty string instead of null DX: fixed AddressReferenceBaseImporterTest
This commit is contained in:
@@ -61,67 +61,48 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
private ?AddressReference $addressReference = null;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*
|
||||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
private string $buildingName = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="boolean")
|
||||
* @ORM\Column(type="boolean", options={"default": false})
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
private bool $confidential = false;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*
|
||||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
private $corridor;
|
||||
private string $corridor = '';
|
||||
|
||||
/**
|
||||
* A list of metadata, added by customizable fields.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $customs = [];
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*
|
||||
* used for the CEDEX information
|
||||
*
|
||||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
private $distribution;
|
||||
private string $distribution = '';
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*
|
||||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
private $extra;
|
||||
private string $extra = '';
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*
|
||||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
private $flat;
|
||||
private string $flat = '';
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*
|
||||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
private $floor;
|
||||
private string $floor = '';
|
||||
|
||||
/**
|
||||
* List of geographical units and addresses.
|
||||
@@ -155,11 +136,9 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
* True if the address is a "no address", aka homeless person, ...
|
||||
*
|
||||
* @Groups({"write"})
|
||||
* @ORM\Column(type="boolean")
|
||||
*
|
||||
* @var bool
|
||||
* @ORM\Column(type="boolean", options={"default": false})
|
||||
*/
|
||||
private $isNoAddress = false;
|
||||
private bool $isNoAddress = false;
|
||||
|
||||
/**
|
||||
* A ThirdParty reference for person's addresses that are linked to a third party.
|
||||
@@ -170,7 +149,7 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
* @Groups({"write"})
|
||||
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
|
||||
*/
|
||||
private $linkedToThirdParty;
|
||||
private ?ThirdParty $linkedToThirdParty;
|
||||
|
||||
/**
|
||||
* A geospatial field storing the coordinates of the Address.
|
||||
@@ -180,7 +159,7 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
* @ORM\Column(type="point", nullable=true)
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
private $point;
|
||||
private ?Point $point = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\PostalCode")
|
||||
@@ -201,28 +180,25 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
private \DateTimeImmutable $refStatusLastUpdate;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*
|
||||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
private $steps;
|
||||
private string $steps = '';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(type="string", length=255)
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
private $street = '';
|
||||
private string $street = '';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(type="string", length=255)
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
private $streetNumber = '';
|
||||
private string $streetNumber = '';
|
||||
|
||||
/**
|
||||
* Indicates when the address starts validation. Used to build an history
|
||||
@@ -256,7 +232,6 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
->setBuildingName($original->getBuildingName())
|
||||
->setConfidential($original->getConfidential())
|
||||
->setCorridor($original->getCorridor())
|
||||
->setCustoms($original->getCustoms())
|
||||
->setDistribution($original->getDistribution())
|
||||
->setExtra($original->getExtra())
|
||||
->setFlat($original->getFlat())
|
||||
@@ -287,7 +262,7 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
return $this->addressReference;
|
||||
}
|
||||
|
||||
public function getBuildingName(): ?string
|
||||
public function getBuildingName(): string
|
||||
{
|
||||
return $this->buildingName;
|
||||
}
|
||||
@@ -297,35 +272,27 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
return $this->confidential;
|
||||
}
|
||||
|
||||
public function getCorridor(): ?string
|
||||
public function getCorridor(): string
|
||||
{
|
||||
return $this->corridor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get customs informations in the address.
|
||||
*/
|
||||
public function getCustoms(): array
|
||||
{
|
||||
return $this->customs;
|
||||
}
|
||||
|
||||
public function getDistribution(): ?string
|
||||
public function getDistribution(): string
|
||||
{
|
||||
return $this->distribution;
|
||||
}
|
||||
|
||||
public function getExtra(): ?string
|
||||
public function getExtra(): string
|
||||
{
|
||||
return $this->extra;
|
||||
}
|
||||
|
||||
public function getFlat(): ?string
|
||||
public function getFlat(): string
|
||||
{
|
||||
return $this->flat;
|
||||
}
|
||||
|
||||
public function getFloor(): ?string
|
||||
public function getFloor(): string
|
||||
{
|
||||
return $this->floor;
|
||||
}
|
||||
@@ -376,12 +343,22 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
return $this->postcode;
|
||||
}
|
||||
|
||||
public function getSteps(): ?string
|
||||
public function getRefStatus(): string
|
||||
{
|
||||
return $this->refStatus;
|
||||
}
|
||||
|
||||
public function getRefStatusLastUpdate(): \DateTimeImmutable
|
||||
{
|
||||
return $this->refStatusLastUpdate;
|
||||
}
|
||||
|
||||
public function getSteps(): string
|
||||
{
|
||||
return $this->steps;
|
||||
}
|
||||
|
||||
public function getStreet(): ?string
|
||||
public function getStreet(): string
|
||||
{
|
||||
return $this->street;
|
||||
}
|
||||
@@ -390,6 +367,7 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
* Get streetAddress1 (legacy function).
|
||||
*
|
||||
* @return string
|
||||
* @deprecated
|
||||
*/
|
||||
public function getStreetAddress1()
|
||||
{
|
||||
@@ -400,13 +378,14 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
* Get streetAddress2 (legacy function).
|
||||
*
|
||||
* @return string
|
||||
* @deprecated
|
||||
*/
|
||||
public function getStreetAddress2()
|
||||
{
|
||||
return $this->streetNumber;
|
||||
}
|
||||
|
||||
public function getStreetNumber(): ?string
|
||||
public function getStreetNumber(): string
|
||||
{
|
||||
return $this->streetNumber;
|
||||
}
|
||||
@@ -414,7 +393,7 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
/**
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getValidFrom()
|
||||
public function getValidFrom(): DateTime
|
||||
{
|
||||
return $this->validFrom;
|
||||
}
|
||||
@@ -443,7 +422,7 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
|
||||
public function setBuildingName(?string $buildingName): self
|
||||
{
|
||||
$this->buildingName = $buildingName;
|
||||
$this->buildingName = (string) $buildingName;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -457,47 +436,35 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
|
||||
public function setCorridor(?string $corridor): self
|
||||
{
|
||||
$this->corridor = $corridor;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Store custom informations in the address.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCustoms(array $customs): self
|
||||
{
|
||||
$this->customs = $customs;
|
||||
$this->corridor = (string) $corridor;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setDistribution(?string $distribution): self
|
||||
{
|
||||
$this->distribution = $distribution;
|
||||
$this->distribution = (string) $distribution;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setExtra(?string $extra): self
|
||||
{
|
||||
$this->extra = $extra;
|
||||
$this->extra = (string) $extra;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setFlat(?string $flat): self
|
||||
{
|
||||
$this->flat = $flat;
|
||||
$this->flat = (string) $flat;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setFloor(?string $floor): self
|
||||
{
|
||||
$this->floor = $floor;
|
||||
$this->floor = (string) $floor;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -544,19 +511,40 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the ref status
|
||||
*
|
||||
* @param Address::ADDR_REFERENCE_STATUS_* $refStatus
|
||||
* @param bool|null $updateLastUpdate Also update the "refStatusLastUpdate"
|
||||
*/
|
||||
public function setRefStatus(string $refStatus, ?bool $updateLastUpdate = true): self
|
||||
{
|
||||
$this->refStatus = $refStatus;
|
||||
|
||||
if ($updateLastUpdate) {
|
||||
$this->setRefStatusLastUpdate(new \DateTimeImmutable('now'));
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setRefStatusLastUpdate(\DateTimeImmutable $refStatusLastUpdate): self
|
||||
{
|
||||
$this->refStatusLastUpdate = $refStatusLastUpdate;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setSteps(?string $steps): self
|
||||
{
|
||||
$this->steps = $steps;
|
||||
$this->steps = (string) $steps;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setStreet(?string $street): self
|
||||
{
|
||||
if (null === $street) {
|
||||
$street = '';
|
||||
}
|
||||
$this->street = $street;
|
||||
$this->street = (string) $street;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -567,6 +555,7 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
* @param string $streetAddress1
|
||||
*
|
||||
* @return Address
|
||||
* @deprecated
|
||||
*/
|
||||
public function setStreetAddress1($streetAddress1)
|
||||
{
|
||||
@@ -579,7 +568,7 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
* Set streetAddress2 (legacy function).
|
||||
*
|
||||
* @param string $streetAddress2
|
||||
*
|
||||
* @deprecated
|
||||
* @return Address
|
||||
*/
|
||||
public function setStreetAddress2($streetAddress2)
|
||||
@@ -591,10 +580,7 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
|
||||
public function setStreetNumber(?string $streetNumber): self
|
||||
{
|
||||
if (null === $streetNumber) {
|
||||
$streetNumber = '';
|
||||
}
|
||||
$this->streetNumber = $streetNumber;
|
||||
$this->streetNumber = (string) $streetNumber;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -641,7 +627,7 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
return;
|
||||
}
|
||||
|
||||
if (empty($this->getStreetAddress1())) {
|
||||
if ('' === $this->getStreet()) {
|
||||
$context
|
||||
->buildViolation('address.street1-should-be-set')
|
||||
->atPath('streetAddress1')
|
||||
|
@@ -55,13 +55,13 @@ class AddressReference
|
||||
* @ORM\Column(type="integer")
|
||||
* @groups({"read"})
|
||||
*/
|
||||
private $id;
|
||||
private ?int $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
* @groups({"read"})
|
||||
*/
|
||||
private $municipalityCode;
|
||||
private string $municipalityCode = '';
|
||||
|
||||
/**
|
||||
* A geospatial field storing the coordinates of the Address.
|
||||
@@ -71,7 +71,7 @@ class AddressReference
|
||||
* @ORM\Column(type="point")
|
||||
* @groups({"read"})
|
||||
*/
|
||||
private $point;
|
||||
private ?Point $point = null;
|
||||
|
||||
/**
|
||||
* @var PostalCode
|
||||
@@ -79,31 +79,31 @@ class AddressReference
|
||||
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\PostalCode")
|
||||
* @groups({"read"})
|
||||
*/
|
||||
private $postcode;
|
||||
private ?PostalCode $postcode;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=255)
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
* @groups({"read"})
|
||||
*/
|
||||
private $refId;
|
||||
private string $refId = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
* @groups({"read"})
|
||||
*/
|
||||
private $source;
|
||||
private string $source = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
* @groups({"read"})
|
||||
*/
|
||||
private $street;
|
||||
private string $street = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
* @groups({"read"})
|
||||
*/
|
||||
private $streetNumber;
|
||||
private string $streetNumber = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="datetime_immutable", nullable=true)
|
||||
@@ -126,7 +126,7 @@ class AddressReference
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getMunicipalityCode(): ?string
|
||||
public function getMunicipalityCode(): string
|
||||
{
|
||||
return $this->municipalityCode;
|
||||
}
|
||||
@@ -141,27 +141,27 @@ class AddressReference
|
||||
*
|
||||
* @return PostalCode
|
||||
*/
|
||||
public function getPostcode()
|
||||
public function getPostcode(): ?PostalCode
|
||||
{
|
||||
return $this->postcode;
|
||||
}
|
||||
|
||||
public function getRefId(): ?string
|
||||
public function getRefId(): string
|
||||
{
|
||||
return $this->refId;
|
||||
}
|
||||
|
||||
public function getSource(): ?string
|
||||
public function getSource(): string
|
||||
{
|
||||
return $this->source;
|
||||
}
|
||||
|
||||
public function getStreet(): ?string
|
||||
public function getStreet(): string
|
||||
{
|
||||
return $this->street;
|
||||
}
|
||||
|
||||
public function getStreetNumber(): ?string
|
||||
public function getStreetNumber(): string
|
||||
{
|
||||
return $this->streetNumber;
|
||||
}
|
||||
@@ -192,7 +192,7 @@ class AddressReference
|
||||
|
||||
public function setMunicipalityCode(?string $municipalityCode): self
|
||||
{
|
||||
$this->municipalityCode = $municipalityCode;
|
||||
$this->municipalityCode = (string) $municipalityCode;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -227,21 +227,21 @@ class AddressReference
|
||||
|
||||
public function setSource(?string $source): self
|
||||
{
|
||||
$this->source = $source;
|
||||
$this->source = (string) $source;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setStreet(?string $street): self
|
||||
{
|
||||
$this->street = $street;
|
||||
$this->street = (string) $street;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setStreetNumber(?string $streetNumber): self
|
||||
{
|
||||
$this->streetNumber = $streetNumber;
|
||||
$this->streetNumber = (string) $streetNumber;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
Reference in New Issue
Block a user