mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
Merge remote-tracking branch 'origin/111_exports_suite' into calendar/finalization
This commit is contained in:
@@ -15,6 +15,8 @@ use Chill\MainBundle\Doctrine\Model\Point;
|
||||
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;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
@@ -97,6 +99,23 @@ class Address
|
||||
*/
|
||||
private $floor;
|
||||
|
||||
/**
|
||||
* List of geographical units and addresses.
|
||||
*
|
||||
* This list is computed by a materialized view. It won't be populated until a refresh is done
|
||||
* on the materialized view.
|
||||
*
|
||||
* @var Collection<int, GeographicalUnit>|GeographicalUnit[]
|
||||
* @readonly
|
||||
* @ORM\ManyToMany(targetEntity=GeographicalUnit::class)
|
||||
* @ORM\JoinTable(
|
||||
* name="view_chill_main_address_geographical_unit",
|
||||
* joinColumns={@ORM\JoinColumn(name="address_id")},
|
||||
* inverseJoinColumns={@ORM\JoinColumn(name="geographical_unit_id")}
|
||||
* )
|
||||
*/
|
||||
private Collection $geographicalUnits;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*
|
||||
@@ -104,8 +123,9 @@ class Address
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
* @Groups({"write"})
|
||||
* @readonly
|
||||
*/
|
||||
private $id;
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* True if the address is a "no address", aka homeless person, ...
|
||||
@@ -190,6 +210,7 @@ class Address
|
||||
public function __construct()
|
||||
{
|
||||
$this->validFrom = new DateTime();
|
||||
$this->geographicalUnits = new ArrayCollection();
|
||||
}
|
||||
|
||||
public static function createFromAddress(Address $original): Address
|
||||
@@ -273,6 +294,14 @@ class Address
|
||||
return $this->floor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, GeographicalUnit>|GeographicalUnit[]
|
||||
*/
|
||||
public function getGeographicalUnits(): Collection
|
||||
{
|
||||
return $this->geographicalUnits;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id.
|
||||
*
|
||||
|
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Entity\GeographicalUnit;
|
||||
|
||||
/**
|
||||
* Simple GeographialUnit Data Transfer Object.
|
||||
*
|
||||
* This allow to get access to id, unitName, unitRefId, and layer's id
|
||||
*/
|
||||
class SimpleGeographicalUnitDTO
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @psalm-readonly
|
||||
*/
|
||||
public int $id;
|
||||
|
||||
/**
|
||||
* @readonly
|
||||
* @psalm-readonly
|
||||
*/
|
||||
public int $layerId;
|
||||
|
||||
/**
|
||||
* @readonly
|
||||
* @psalm-readonly
|
||||
*/
|
||||
public string $unitName;
|
||||
|
||||
/**
|
||||
* @readonly
|
||||
* @psalm-readonly
|
||||
*/
|
||||
public string $unitRefId;
|
||||
|
||||
public function __construct(int $id, string $unitName, string $unitRefId, int $layerId)
|
||||
{
|
||||
$this->id = $id;
|
||||
$this->unitName = $unitName;
|
||||
$this->unitRefId = $unitRefId;
|
||||
$this->layerId = $layerId;
|
||||
}
|
||||
}
|
136
src/Bundle/ChillMainBundle/Entity/SavedExport.php
Normal file
136
src/Bundle/ChillMainBundle/Entity/SavedExport.php
Normal file
@@ -0,0 +1,136 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Entity;
|
||||
|
||||
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
|
||||
use Chill\MainBundle\Doctrine\Model\TrackCreationTrait;
|
||||
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
|
||||
use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Ramsey\Uuid\UuidInterface;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="chill_main_saved_export")
|
||||
*/
|
||||
class SavedExport implements TrackCreationInterface, TrackUpdateInterface
|
||||
{
|
||||
use TrackCreationTrait;
|
||||
|
||||
use TrackUpdateTrait;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
* @Assert\NotBlank
|
||||
*/
|
||||
private string $description = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
*/
|
||||
private string $exportAlias;
|
||||
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\Column(name="id", type="uuid", unique="true")
|
||||
* @ORM\GeneratedValue(strategy="NONE")
|
||||
*/
|
||||
private UuidInterface $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="json", nullable=false, options={"default": "[]"})
|
||||
*/
|
||||
private array $options = [];
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
* @Assert\NotBlank
|
||||
*/
|
||||
private string $title = '';
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=User::class)
|
||||
*/
|
||||
private User $user;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->id = Uuid::uuid4();
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function getExportAlias(): string
|
||||
{
|
||||
return $this->exportAlias;
|
||||
}
|
||||
|
||||
public function getId(): UuidInterface
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getOptions(): array
|
||||
{
|
||||
return $this->options;
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
public function getUser(): User
|
||||
{
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
public function setDescription(?string $description): SavedExport
|
||||
{
|
||||
$this->description = (string) $description;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setExportAlias(string $exportAlias): SavedExport
|
||||
{
|
||||
$this->exportAlias = $exportAlias;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setOptions(array $options): SavedExport
|
||||
{
|
||||
$this->options = $options;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setTitle(?string $title): SavedExport
|
||||
{
|
||||
$this->title = (string) $title;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setUser(User $user): SavedExport
|
||||
{
|
||||
$this->user = $user;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user