refs #725. Added RemoteCalendar into OrganizationalUnit
parent
f6649231b6
commit
d75712428d
|
@ -4,6 +4,7 @@ namespace App\Dto\Input;
|
||||||
|
|
||||||
use ApiPlatform\Metadata\ApiProperty;
|
use ApiPlatform\Metadata\ApiProperty;
|
||||||
use App\Dto\Output\OrganizationalUnitOutput;
|
use App\Dto\Output\OrganizationalUnitOutput;
|
||||||
|
use App\Dto\Output\RemoteCalendarOutput;
|
||||||
use App\Entity\OrganizationalUnit;
|
use App\Entity\OrganizationalUnit;
|
||||||
use App\Validator\Constraints\OrganizationalUnitMulticastMode;
|
use App\Validator\Constraints\OrganizationalUnitMulticastMode;
|
||||||
use App\Validator\Constraints\OrganizationalUnitMulticastPort;
|
use App\Validator\Constraints\OrganizationalUnitMulticastPort;
|
||||||
|
@ -50,6 +51,9 @@ class OrganizationalUnitInput
|
||||||
#[Assert\Valid()]
|
#[Assert\Valid()]
|
||||||
public ?NetworkSettingsInput $networkSettings = null;
|
public ?NetworkSettingsInput $networkSettings = null;
|
||||||
|
|
||||||
|
#[Groups(['organizational-unit:write'])]
|
||||||
|
public ?RemoteCalendarOutput $remoteCalendar = null;
|
||||||
|
|
||||||
public function __construct(?OrganizationalUnit $organizationalUnit = null)
|
public function __construct(?OrganizationalUnit $organizationalUnit = null)
|
||||||
{
|
{
|
||||||
if (!$organizationalUnit) {
|
if (!$organizationalUnit) {
|
||||||
|
@ -70,6 +74,10 @@ class OrganizationalUnitInput
|
||||||
if ($organizationalUnit->getNetworkSettings()){
|
if ($organizationalUnit->getNetworkSettings()){
|
||||||
$this->networkSettings = new NetworkSettingsInput($organizationalUnit->getNetworkSettings());
|
$this->networkSettings = new NetworkSettingsInput($organizationalUnit->getNetworkSettings());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($organizationalUnit->getRemoteCalendar()) {
|
||||||
|
$this->remoteCalendar = new RemoteCalendarOutput($organizationalUnit->getRemoteCalendar());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createOrUpdateEntity(?OrganizationalUnit $organizationalUnit = null): OrganizationalUnit
|
public function createOrUpdateEntity(?OrganizationalUnit $organizationalUnit = null): OrganizationalUnit
|
||||||
|
@ -94,6 +102,10 @@ class OrganizationalUnitInput
|
||||||
$organizationalUnit->setNetworkSettings($this->networkSettings->createOrUpdateEntity($organizationalUnit->getNetworkSettings()));
|
$organizationalUnit->setNetworkSettings($this->networkSettings->createOrUpdateEntity($organizationalUnit->getNetworkSettings()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->remoteCalendar) {
|
||||||
|
$organizationalUnit->setRemoteCalendar($this->remoteCalendar->getEntity());
|
||||||
|
}
|
||||||
|
|
||||||
return $organizationalUnit;
|
return $organizationalUnit;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -51,6 +51,10 @@ final class OrganizationalUnitOutput extends AbstractOutput
|
||||||
#[Groups(['organizational-unit:read'])]
|
#[Groups(['organizational-unit:read'])]
|
||||||
public array $clients = [];
|
public array $clients = [];
|
||||||
|
|
||||||
|
#[Groups(['organizational-unit:read', "client:read"])]
|
||||||
|
#[ApiProperty(readableLink: true)]
|
||||||
|
public ?RemoteCalendarOutput $remoteCalendar = null;
|
||||||
|
|
||||||
#[Groups(['organizational-unit:read'])]
|
#[Groups(['organizational-unit:read'])]
|
||||||
public \DateTime $createdAt;
|
public \DateTime $createdAt;
|
||||||
|
|
||||||
|
@ -70,7 +74,7 @@ final class OrganizationalUnitOutput extends AbstractOutput
|
||||||
$this->capacity = $organizationalUnit->getCapacity();
|
$this->capacity = $organizationalUnit->getCapacity();
|
||||||
$this->type = $organizationalUnit->getType();
|
$this->type = $organizationalUnit->getType();
|
||||||
$this->networkSettings = $organizationalUnit->getNetworkSettings() ? new NetworkSettingsOutput($organizationalUnit->getNetworkSettings()) : null;
|
$this->networkSettings = $organizationalUnit->getNetworkSettings() ? new NetworkSettingsOutput($organizationalUnit->getNetworkSettings()) : null;
|
||||||
|
$this->remoteCalendar = $organizationalUnit->getRemoteCalendar() ? new RemoteCalendarOutput($organizationalUnit->getRemoteCalendar()) : null;
|
||||||
if ($organizationalUnit->getParent()) {
|
if ($organizationalUnit->getParent()) {
|
||||||
$this->parent = new self($organizationalUnit->getParent());
|
$this->parent = new self($organizationalUnit->getParent());
|
||||||
}
|
}
|
||||||
|
@ -87,6 +91,7 @@ final class OrganizationalUnitOutput extends AbstractOutput
|
||||||
)->toArray();
|
)->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$this->path = $organizationalUnit->getPath();
|
$this->path = $organizationalUnit->getPath();
|
||||||
$this->createdAt = $organizationalUnit->getCreatedAt();
|
$this->createdAt = $organizationalUnit->getCreatedAt();
|
||||||
$this->createdBy = $organizationalUnit->getCreatedBy();
|
$this->createdBy = $organizationalUnit->getCreatedBy();
|
||||||
|
|
|
@ -372,4 +372,16 @@ class OrganizationalUnit extends AbstractEntity
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getRemoteCalendar(): ?RemoteCalendar
|
||||||
|
{
|
||||||
|
return $this->remoteCalendar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setRemoteCalendar(?RemoteCalendar $remoteCalendar): static
|
||||||
|
{
|
||||||
|
$this->remoteCalendar = $remoteCalendar;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue