mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
wip: synchro of calendar range
This commit is contained in:
@@ -12,6 +12,10 @@ declare(strict_types=1);
|
||||
namespace Chill\CalendarBundle\Entity;
|
||||
|
||||
use Chill\CalendarBundle\Repository\CalendarRangeRepository;
|
||||
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 Chill\MainBundle\Entity\User;
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
@@ -20,11 +24,17 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
|
||||
/**
|
||||
* @ORM\Table(name="chill_calendar.calendar_range")
|
||||
* @ORM\Table(name="chill_calendar.calendar_range", indexes={@ORM\Index(name="idx_calendar_range_remote", columns={"remoteId"})})
|
||||
* @ORM\Entity(repositoryClass=CalendarRangeRepository::class)
|
||||
*/
|
||||
class CalendarRange
|
||||
class CalendarRange implements TrackCreationInterface, TrackUpdateInterface
|
||||
{
|
||||
use RemoteCalendarTrait;
|
||||
|
||||
use TrackCreationTrait;
|
||||
|
||||
use TrackUpdateTrait;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity=Calendar::class,
|
||||
* mappedBy="calendarRange")
|
||||
|
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\CalendarBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
trait RemoteCalendarTrait
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(type="json", options={"default": "[]"}, nullable=false)
|
||||
*/
|
||||
private array $remoteAttributes = [];
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", options={"default": ""}, nullable=false)
|
||||
*/
|
||||
private string $remoteId = '';
|
||||
|
||||
public function addRemoteAttributes(array $remoteAttributes): self
|
||||
{
|
||||
$this->remoteAttributes = array_merge($this->remoteAttributes, $remoteAttributes);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getRemoteAttributes(): array
|
||||
{
|
||||
return $this->remoteAttributes;
|
||||
}
|
||||
|
||||
public function getRemoteId(): string
|
||||
{
|
||||
return $this->remoteId;
|
||||
}
|
||||
|
||||
public function hasRemoteId(): bool
|
||||
{
|
||||
return '' !== $this->remoteId;
|
||||
}
|
||||
|
||||
public function setRemoteId(string $remoteId): self
|
||||
{
|
||||
$this->remoteId = $remoteId;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user