diff --git a/Admin/Installer.php b/Admin/Installer.php index edc98e8..1fca27b 100755 --- a/Admin/Installer.php +++ b/Admin/Installer.php @@ -51,7 +51,7 @@ final class Installer extends InstallerAbstract private static function installDefaultUnit() : void { $unit = new Unit(); - $unit->setName('Orange Management'); + $unit->name = 'Orange Management'; UnitMapper::create($unit); } diff --git a/Controller/ApiController.php b/Controller/ApiController.php index b2fda12..74762c8 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -111,7 +111,7 @@ final class ApiController extends Controller /** @var Unit $old */ $old = clone UnitMapper::get((int) $request->getData('id')); $new = $this->updateUnitFromRequest($request); - $this->updateModel($request->getHeader()->getAccount(), $old, $new, UnitMapper::class, 'unit', $request->getOrigin()); + $this->updateModel($request->header->account, $old, $new, UnitMapper::class, 'unit', $request->getOrigin()); $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Unit', 'Unit successfully updated.', $new); } @@ -128,12 +128,12 @@ final class ApiController extends Controller { /** @var Unit $unit */ $unit = UnitMapper::get((int) $request->getData('id')); - $unit->setName((string) ($request->getData('name') ?? $unit->getName())); - $unit->setDescriptionRaw((string) ($request->getData('description') ?? $unit->getDescriptionRaw())); - $unit->setDescription(Markdown::parse((string) ($request->getData('description') ?? $unit->getDescriptionRaw()))); + $unit->name = (string) ($request->getData('name') ?? $unit->name); + $unit->descriptionRaw = (string) ($request->getData('description') ?? $unit->descriptionRaw); + $unit->description = Markdown::parse((string) ($request->getData('description') ?? $unit->descriptionRaw)); $parent = (int) $request->getData('parent'); - $unit->setParent(!empty($parent) ? new NullUnit($parent) : $unit->getParent()); + $unit->parent = !empty($parent) ? new NullUnit($parent) : $unit->parent; $unit->setStatus((int) ($request->getData('status') ?? $unit->getStatus())); return $unit; @@ -156,7 +156,7 @@ final class ApiController extends Controller { /** @var Unit $unit */ $unit = UnitMapper::get((int) $request->getData('id')); - $this->deleteModel($request->getHeader()->getAccount(), $unit, UnitMapper::class, 'unit', $request->getOrigin()); + $this->deleteModel($request->header->account, $unit, UnitMapper::class, 'unit', $request->getOrigin()); $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Unit', 'Unit successfully deleted.', $unit); } @@ -177,17 +177,17 @@ final class ApiController extends Controller { if (!empty($val = $this->validateUnitCreate($request))) { $response->set('unit_create', new FormValidation($val)); - $response->getHeader()->setStatusCode(RequestStatusCode::R_400); + $response->header->status = RequestStatusCode::R_400; return; } $unit = $this->createUnitFromRequest($request); - $this->createModel($request->getHeader()->getAccount(), $unit, UnitMapper::class, 'unit', $request->getOrigin()); + $this->createModel($request->header->account, $unit, UnitMapper::class, 'unit', $request->getOrigin()); if ($this->app->appSettings->get(null, SettingsEnum::GROUP_GENERATE_AUTOMATICALLY_UNIT)['content'] === '1') { $newRequest = new HttpRequest(); - $newRequest->setData('name', 'org:unit:' . \strtolower($unit->getName())); + $newRequest->setData('name', 'org:unit:' . \strtolower($unit->name)); $newRequest->setData('status', GroupStatus::ACTIVE); $this->app->moduleManager->get('Admin')->apiGroupCreate($newRequest, $response, $data); } @@ -207,12 +207,12 @@ final class ApiController extends Controller private function createUnitFromRequest(RequestAbstract $request) : Unit { $unit = new Unit(); - $unit->setName((string) $request->getData('name')); - $unit->setDescriptionRaw((string) ($request->getData('description') ?? '')); - $unit->setDescription(Markdown::parse((string) ($request->getData('description') ?? ''))); + $unit->name = (string) $request->getData('name'); + $unit->descriptionRaw = (string) ($request->getData('description') ?? ''); + $unit->description = Markdown::parse((string) ($request->getData('description') ?? '')); $parent = (int) $request->getData('parent'); - $unit->setParent(!empty($parent) ? new NullUnit($parent) : null); + $unit->parent = new NullUnit($parent); $unit->setStatus((int) $request->getData('status')); return $unit; @@ -236,7 +236,7 @@ final class ApiController extends Controller $uploadedFiles = $request->getFiles() ?? []; if (empty($uploadedFiles)) { $this->fillJsonResponse($request, $response, NotificationLevel::ERROR, 'Unit', 'Invalid unit image', $uploadedFiles); - $response->getHeader()->setStatusCode(RequestStatusCode::R_400); + $response->header->status = RequestStatusCode::R_400; return; } @@ -248,14 +248,14 @@ final class ApiController extends Controller $uploaded = $this->app->moduleManager->get('Media')->uploadFiles( $request->getData('name') ?? '', $uploadedFiles, - $request->getHeader()->getAccount(), + $request->header->account, 'Modules/Media/Files', '/Modules/Organization' ); - $unit->setImage(\reset($uploaded)); + $unit->image = \reset($uploaded); - $this->updateModel($request->getHeader()->getAccount(), $old, $unit, UnitMapper::class, 'unit', $request->getOrigin()); + $this->updateModel($request->header->account, $old, $unit, UnitMapper::class, 'unit', $request->getOrigin()); $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Unit', 'Unit image successfully updated', $unit); } @@ -324,7 +324,7 @@ final class ApiController extends Controller { /** @var Position $position */ $position = PositionMapper::get((int) $request->getData('id')); - $this->deleteModel($request->getHeader()->getAccount(), $position, PositionMapper::class, 'position', $request->getOrigin()); + $this->deleteModel($request->header->account, $position, PositionMapper::class, 'position', $request->getOrigin()); $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Position', 'Position successfully deleted.', $position); } @@ -346,7 +346,7 @@ final class ApiController extends Controller /** @var Position $old */ $old = clone PositionMapper::get((int) $request->getData('id')); $new = $this->updatePositionFromRequest($request); - $this->updateModel($request->getHeader()->getAccount(), $old, $new, PositionMapper::class, 'position', $request->getOrigin()); + $this->updateModel($request->header->account, $old, $new, PositionMapper::class, 'position', $request->getOrigin()); $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Position', 'Position successfully updated.', $new); } @@ -363,15 +363,15 @@ final class ApiController extends Controller { /** @var Position $position */ $position = PositionMapper::get((int) $request->getData('id')); - $position->setName((string) ($request->getData('name') ?? $position->getName())); - $position->setDescriptionRaw((string) ($request->getData('description') ?? $position->getDescriptionRaw())); - $position->setDescription(Markdown::parse((string) ($request->getData('description') ?? $position->getDescriptionRaw()))); + $position->name = (string) ($request->getData('name') ?? $position->name); + $position->descriptionRaw = (string) ($request->getData('description') ?? $position->descriptionRaw); + $position->description = Markdown::parse((string) ($request->getData('description') ?? $position->descriptionRaw)); $parent = (int) $request->getData('parent'); - $position->setParent(!empty($parent) ? new NullPosition($parent) : $position->getParent()); + $position->parent = !empty($parent) ? new NullPosition($parent) : $position->parent; $department = (int) $request->getData('department'); - $position->setDepartment(!empty($department) ? new NullDepartment($department) : $position->getDepartment()); + $position->department = !empty($department) ? new NullDepartment($department) : $position->department; $position->setStatus((int) ($request->getData('status') ?? $position->getStatus())); return $position; @@ -394,17 +394,17 @@ final class ApiController extends Controller { if (!empty($val = $this->validatePositionCreate($request))) { $response->set('position_create', new FormValidation($val)); - $response->getHeader()->setStatusCode(RequestStatusCode::R_400); + $response->header->status = RequestStatusCode::R_400; return; } $position = $this->createPositionFromRequest($request); - $this->createModel($request->getHeader()->getAccount(), $position, PositionMapper::class, 'position', $request->getOrigin()); + $this->createModel($request->header->account, $position, PositionMapper::class, 'position', $request->getOrigin()); if ($this->app->appSettings->get(null, SettingsEnum::GROUP_GENERATE_AUTOMATICALLY_POSITION)['content'] === '1') { $newRequest = new HttpRequest(); - $newRequest->setData('name', 'org:pos:' . \strtolower($position->getName())); + $newRequest->setData('name', 'org:pos:' . \strtolower($position->name)); $newRequest->setData('status', GroupStatus::ACTIVE); $this->app->moduleManager->get('Admin')->apiGroupCreate($newRequest, $response, $data); } @@ -424,16 +424,16 @@ final class ApiController extends Controller private function createPositionFromRequest(RequestAbstract $request) : Position { $position = new Position(); - $position->setName((string) ($request->getData('name'))); + $position->name = (string) ($request->getData('name')); $position->setStatus((int) $request->getData('status')); - $position->setDescriptionRaw((string) ($request->getData('description') ?? '')); - $position->setDescription(Markdown::parse((string) ($request->getData('description') ?? ''))); + $position->descriptionRaw = (string) ($request->getData('description') ?? ''); + $position->description = Markdown::parse((string) ($request->getData('description') ?? '')); $parent = (int) $request->getData('parent'); - $position->setParent(!empty($parent) ? new NullPosition($parent) : null); + $position->parent = new NullPosition($parent); $department = (int) $request->getData('department'); - $position->setDepartment(!empty($department) ? new NullDepartment($department) : null); + $position->department = new NullDepartment($department); return $position; } @@ -503,7 +503,7 @@ final class ApiController extends Controller /** @var Department $old */ $old = clone DepartmentMapper::get((int) $request->getData('id')); $new = $this->updateDepartmentFromRequest($request); - $this->updateModel($request->getHeader()->getAccount(), $old, $new, DepartmentMapper::class, 'department', $request->getOrigin()); + $this->updateModel($request->header->account, $old, $new, DepartmentMapper::class, 'department', $request->getOrigin()); $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Department', 'Department successfully updated.', $new); } @@ -520,16 +520,16 @@ final class ApiController extends Controller { /** @var Department $department */ $department = DepartmentMapper::get((int) $request->getData('id')); - $department->setName((string) ($request->getData('name') ?? $department->getName())); - $department->setDescriptionRaw((string) ($request->getData('description') ?? $department->getDescriptionRaw())); - $department->setDescription(Markdown::parse((string) ($request->getData('description') ?? $department->getDescriptionRaw()))); + $department->name = (string) ($request->getData('name') ?? $department->name); + $department->descriptionRaw = (string) ($request->getData('description') ?? $department->descriptionRaw); + $department->description = Markdown::parse((string) ($request->getData('description') ?? $department->descriptionRaw)); $parent = (int) $request->getData('parent'); - $department->setParent(!empty($parent) ? new NullDepartment($parent) : $department->getParent()); + $department->parent = !empty($parent) ? new NullDepartment($parent) : $department->parent; $department->setStatus((int) ($request->getData('status') ?? $department->getStatus())); $unit = (int) $request->getData('unit'); - $department->setUnit(!empty($unit) ? new NullUnit($unit) : $department->getUnit()); + $department->unit = !empty($unit) ? new NullUnit($unit) : $department->unit; return $department; } @@ -551,7 +551,7 @@ final class ApiController extends Controller { /** @var Department $department */ $department = DepartmentMapper::get((int) $request->getData('id')); - $this->deleteModel($request->getHeader()->getAccount(), $department, DepartmentMapper::class, 'department', $request->getOrigin()); + $this->deleteModel($request->header->account, $department, DepartmentMapper::class, 'department', $request->getOrigin()); $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Department', 'Department successfully deleted.', $department); } @@ -572,17 +572,17 @@ final class ApiController extends Controller { if (!empty($val = $this->validateDepartmentCreate($request))) { $response->set('department_create', new FormValidation($val)); - $response->getHeader()->setStatusCode(RequestStatusCode::R_400); + $response->header->status = RequestStatusCode::R_400; return; } $department = $this->createDepartmentFromRequest($request); - $this->createModel($request->getHeader()->getAccount(), $department, DepartmentMapper::class, 'department', $request->getOrigin()); + $this->createModel($request->header->account, $department, DepartmentMapper::class, 'department', $request->getOrigin()); if ($this->app->appSettings->get(null, SettingsEnum::GROUP_GENERATE_AUTOMATICALLY_DEPARTMENT)['content'] === '1') { $newRequest = new HttpRequest(); - $newRequest->setData('name', 'org:dep:' . \strtolower($department->getName())); + $newRequest->setData('name', 'org:dep:' . \strtolower($department->name)); $newRequest->setData('status', GroupStatus::ACTIVE); $this->app->moduleManager->get('Admin')->apiGroupCreate($newRequest, $response, $data); } @@ -602,14 +602,14 @@ final class ApiController extends Controller private function createDepartmentFromRequest(RequestAbstract $request) : Department { $department = new Department(); - $department->setName((string) $request->getData('name')); + $department->name = (string) $request->getData('name'); $department->setStatus((int) $request->getData('status')); $parent = (int) $request->getData('parent'); - $department->setParent(!empty($parent) ? new NullDepartment($parent) : null); - $department->setUnit(new NullUnit((int) ($request->getData('unit') ?? 1))); - $department->setDescriptionRaw((string) ($request->getData('description') ?? '')); - $department->setDescription(Markdown::parse((string) ($request->getData('description') ?? ''))); + $department->parent = new NullDepartment($parent); + $department->unit = new NullUnit((int) ($request->getData('unit') ?? 1)); + $department->descriptionRaw = (string) ($request->getData('description') ?? ''); + $department->description = Markdown::parse((string) ($request->getData('description') ?? '')); return $department; } @@ -629,9 +629,9 @@ final class ApiController extends Controller */ public function apiUnitFind(RequestAbstract $request, ResponseAbstract $response, $data = null) : void { - $response->getHeader()->set('Content-Type', MimeType::M_JSON, true); + $response->header->set('Content-Type', MimeType::M_JSON, true); $response->set( - $request->getUri()->__toString(), + $request->uri->__toString(), \array_values( UnitMapper::find((string) ($request->getData('search') ?? '')) ) @@ -653,9 +653,9 @@ final class ApiController extends Controller */ public function apiDepartmentFind(RequestAbstract $request, ResponseAbstract $response, $data = null) : void { - $response->getHeader()->set('Content-Type', MimeType::M_JSON, true); + $response->header->set('Content-Type', MimeType::M_JSON, true); $response->set( - $request->getUri()->__toString(), + $request->uri->__toString(), \array_values( DepartmentMapper::find((string) ($request->getData('search') ?? '')) ) @@ -677,9 +677,9 @@ final class ApiController extends Controller */ public function apiPositionFind(RequestAbstract $request, ResponseAbstract $response, $data = null) : void { - $response->getHeader()->set('Content-Type', MimeType::M_JSON, true); + $response->header->set('Content-Type', MimeType::M_JSON, true); $response->set( - $request->getUri()->__toString(), + $request->uri->__toString(), \array_values( PositionMapper::find((string) ($request->getData('search') ?? '')) ) diff --git a/Controller/BackendController.php b/Controller/BackendController.php index c7cef24..50a4bea 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -151,9 +151,9 @@ final class BackendController extends Controller foreach ($components as $component) { $ref = null; if ($component instanceof Department) { - $ref = $component->getUnit()->getId(); + $ref = $component->unit->getId(); } elseif ($component instanceof Position) { - $ref = $component->getDepartment()->getId(); + $ref = $component->department->getId(); } if (!isset($tree[$ref])) { @@ -166,9 +166,9 @@ final class BackendController extends Controller $tree[$ref][$component->getId()]['obj'] = $component; - $parent = $component->getParent()->getId(); + $parent = $component->parent->getId(); if (!($component instanceof Position) // parent could be in different department then ignore - || $component->getParent()->getDepartment()->getId() === $component->getDepartment()->getId() + || $component->parent->department->getId() === $component->department->getId() ) { if (!isset($tree[$ref][$parent])) { $tree[$ref][$parent] = ['obj' => null, 'children' => [], 'index' => 0]; diff --git a/Models/Department.php b/Models/Department.php index fa0a98e..d56cb9b 100755 --- a/Models/Department.php +++ b/Models/Department.php @@ -40,15 +40,15 @@ class Department implements \JsonSerializable, ArrayableInterface * @var string * @since 1.0.0 */ - protected string $name = ''; + public string $name = ''; /** * Parent * - * @var null|self + * @var self * @since 1.0.0 */ - protected ?self $parent = null; + public self $parent; /** * Status @@ -64,7 +64,7 @@ class Department implements \JsonSerializable, ArrayableInterface * @var Unit * @since 1.0.0 */ - protected Unit $unit; + public Unit $unit; /** * Description. @@ -72,7 +72,7 @@ class Department implements \JsonSerializable, ArrayableInterface * @var string * @since 1.0.0 */ - protected string $description = ''; + public string $description = ''; /** * Description. @@ -80,7 +80,7 @@ class Department implements \JsonSerializable, ArrayableInterface * @var string * @since 1.0.0 */ - protected string $descriptionRaw = ''; + public string $descriptionRaw = ''; /** * Constructor @@ -91,7 +91,9 @@ class Department implements \JsonSerializable, ArrayableInterface */ public function __construct(string $name = '') { - $this->setName($name); + $this->name = $name; + $this->parent = new NullDepartment(); + $this->unit = new NullUnit(); } /** @@ -106,58 +108,6 @@ class Department implements \JsonSerializable, ArrayableInterface return $this->id; } - /** - * Get name - * - * @return string - * - * @since 1.0.0 - */ - public function getName() : string - { - return $this->name; - } - - /** - * Set name - * - * @param string $name Name - * - * @return void - * - * @since 1.0.0 - */ - public function setName(string $name) : void - { - $this->name = $name; - } - - /** - * Get parent - * - * @return Department - * - * @since 1.0.0 - */ - public function getParent() : self - { - return $this->parent ?? new NullDepartment(); - } - - /** - * Set parent - * - * @param null|self $parent Parent - * - * @return void - * - * @since 1.0.0 - */ - public function setParent(?self $parent) : void - { - $this->parent = $parent; - } - /** * Get status * @@ -184,84 +134,6 @@ class Department implements \JsonSerializable, ArrayableInterface $this->status = $status; } - /** - * Get unit - * - * @return Unit - * - * @since 1.0.0 - */ - public function getUnit() : Unit - { - return $this->unit ?? new NullUnit(); - } - - /** - * Set unit - * - * @param Unit $unit Unit - * - * @return void - * - * @since 1.0.0 - */ - public function setUnit(Unit $unit) : void - { - $this->unit = $unit; - } - - /** - * Get description - * - * @return string - * - * @since 1.0.0 - */ - public function getDescription() : string - { - return $this->description; - } - - /** - * Set description - * - * @param string $desc Description - * - * @return void - * - * @since 1.0.0 - */ - public function setDescription(string $desc) : void - { - $this->description = $desc; - } - - /** - * Get description - * - * @return string - * - * @since 1.0.0 - */ - public function getDescriptionRaw() : string - { - return $this->descriptionRaw; - } - - /** - * Set description - * - * @param string $desc Description - * - * @return void - * - * @since 1.0.0 - */ - public function setDescriptionRaw(string $desc) : void - { - $this->descriptionRaw = $desc; - } - /** * {@inheritdoc} */ diff --git a/Models/NullDepartment.php b/Models/NullDepartment.php index b20ae8a..b73c66d 100755 --- a/Models/NullDepartment.php +++ b/Models/NullDepartment.php @@ -34,6 +34,6 @@ final class NullDepartment extends Department public function __construct(int $id = 0) { $this->id = $id; - parent::__construct(); + $this->unit = new NullUnit(); } } diff --git a/Models/NullUnit.php b/Models/NullUnit.php index 1aaa9a4..3ecb772 100755 --- a/Models/NullUnit.php +++ b/Models/NullUnit.php @@ -14,6 +14,8 @@ declare(strict_types=1); namespace Modules\Organization\Models; +use Modules\Media\Models\NullMedia; + /** * Organization null class. * @@ -34,6 +36,6 @@ final class NullUnit extends Unit public function __construct(int $id = 0) { $this->id = $id; - parent::__construct(); + $this->image = new NullMedia(); } } diff --git a/Models/Position.php b/Models/Position.php index 2d4ac78..37cd49f 100755 --- a/Models/Position.php +++ b/Models/Position.php @@ -40,23 +40,23 @@ class Position implements \JsonSerializable, ArrayableInterface * @var string * @since 1.0.0 */ - private string $name = ''; + public string $name = ''; /** * Parent * - * @var null|Position + * @var Position * @since 1.0.0 */ - private ?self $parent = null; + public self $parent; /** * Department * - * @var null|Department + * @var Department * @since 1.0.0 */ - private ?Department $department = null; + public Department $department; /** * Description. @@ -64,7 +64,7 @@ class Position implements \JsonSerializable, ArrayableInterface * @var string * @since 1.0.0 */ - private string $description = ''; + public string $description = ''; /** * Description. @@ -72,7 +72,7 @@ class Position implements \JsonSerializable, ArrayableInterface * @var string * @since 1.0.0 */ - private string $descriptionRaw = ''; + public string $descriptionRaw = ''; /** * Status @@ -82,6 +82,17 @@ class Position implements \JsonSerializable, ArrayableInterface */ protected int $status = Status::INACTIVE; + /** + * Constructor. + * + * @since 1.0.0 + */ + public function __construct() + { + $this->parent = new NullPosition(); + $this->department = new NullDepartment(); + } + /** * Get id * @@ -94,84 +105,6 @@ class Position implements \JsonSerializable, ArrayableInterface return $this->id; } - /** - * Get name - * - * @return string - * - * @since 1.0.0 - */ - public function getName() : string - { - return $this->name; - } - - /** - * Set name - * - * @param string $name Name - * - * @return void - * - * @since 1.0.0 - */ - public function setName(string $name) : void - { - $this->name = $name; - } - - /** - * Get parent - * - * @return Position - * - * @since 1.0.0 - */ - public function getParent() : self - { - return $this->parent ?? new NullPosition(); - } - - /** - * Set parent - * - * @param null|Position $parent Parent - * - * @return void - * - * @since 1.0.0 - */ - public function setParent(?self $parent) : void - { - $this->parent = $parent; - } - - /** - * Get parent - * - * @return Department - * - * @since 1.0.0 - */ - public function getDepartment() : Department - { - return $this->department ?? new NullDepartment(); - } - - /** - * Set department - * - * @param null|Department $department Department - * - * @return void - * - * @since 1.0.0 - */ - public function setDepartment(?Department $department) : void - { - $this->department = $department; - } - /** * Get status * @@ -198,58 +131,6 @@ class Position implements \JsonSerializable, ArrayableInterface $this->status = $status; } - /** - * Get description - * - * @return string - * - * @since 1.0.0 - */ - public function getDescription() : string - { - return $this->description; - } - - /** - * Set description - * - * @param string $desc Description - * - * @return void - * - * @since 1.0.0 - */ - public function setDescription(string $desc) : void - { - $this->description = $desc; - } - - /** - * Get description - * - * @return string - * - * @since 1.0.0 - */ - public function getDescriptionRaw() : string - { - return $this->descriptionRaw; - } - - /** - * Set description - * - * @param string $desc Description - * - * @return void - * - * @since 1.0.0 - */ - public function setDescriptionRaw(string $desc) : void - { - $this->descriptionRaw = $desc; - } - /** * {@inheritdoc} */ diff --git a/Models/Unit.php b/Models/Unit.php index 1bdaccb..9fdc5a7 100755 --- a/Models/Unit.php +++ b/Models/Unit.php @@ -42,7 +42,7 @@ class Unit implements \JsonSerializable, ArrayableInterface * @var string * @since 1.0.0 */ - private string $name = ''; + public string $name = ''; /** * Unit image. @@ -50,7 +50,7 @@ class Unit implements \JsonSerializable, ArrayableInterface * @var Media * @since 1.0.0 */ - protected Media $image; + public Media $image; /** * Parent @@ -58,7 +58,7 @@ class Unit implements \JsonSerializable, ArrayableInterface * @var null|Unit * @since 1.0.0 */ - private ?self $parent = null; + public ?self $parent = null; /** * Description. @@ -66,7 +66,7 @@ class Unit implements \JsonSerializable, ArrayableInterface * @var string * @since 1.0.0 */ - private string $description = ''; + public string $description = ''; /** * Description. @@ -74,7 +74,7 @@ class Unit implements \JsonSerializable, ArrayableInterface * @var string * @since 1.0.0 */ - protected string $descriptionRaw = ''; + public string $descriptionRaw = ''; /** * Status @@ -92,6 +92,7 @@ class Unit implements \JsonSerializable, ArrayableInterface public function __construct() { $this->image = new NullMedia(); + $this->parent = new NullUnit(); } /** @@ -106,84 +107,6 @@ class Unit implements \JsonSerializable, ArrayableInterface return $this->id; } - /** - * Get name - * - * @return string - * - * @since 1.0.0 - */ - public function getName() : string - { - return $this->name; - } - - /** - * Set name - * - * @param string $name Name - * - * @return void - * - * @since 1.0.0 - */ - public function setName(string $name) : void - { - $this->name = $name; - } - - /** - * Get unit image. - * - * @return Media - * - * @since 1.0.0 - */ - public function getImage() : Media - { - return $this->image ?? new NullMedia(); - } - - /** - * Set unit image. - * - * @param Media $image Profile image - * - * @return void - * - * @since 1.0.0 - */ - public function setImage(Media $image) : void - { - $this->image = $image; - } - - /** - * Get parent - * - * @return Unit - * - * @since 1.0.0 - */ - public function getParent() : self - { - return $this->parent ?? new NullUnit(); - } - - /** - * Set parent - * - * @param null|Unit $parent Parent - * - * @return void - * - * @since 1.0.0 - */ - public function setParent(?self $parent) : void - { - $this->parent = $parent; - } - /** * Get status * @@ -210,58 +133,6 @@ class Unit implements \JsonSerializable, ArrayableInterface $this->status = $status; } - /** - * Get description - * - * @return string - * - * @since 1.0.0 - */ - public function getDescription() : string - { - return $this->description; - } - - /** - * Set description - * - * @param string $desc Description - * - * @return void - * - * @since 1.0.0 - */ - public function setDescription(string $desc) : void - { - $this->description = $desc; - } - - /** - * Get description - * - * @return string - * - * @since 1.0.0 - */ - public function getDescriptionRaw() : string - { - return $this->descriptionRaw; - } - - /** - * Set description - * - * @param string $desc Description - * - * @return void - * - * @since 1.0.0 - */ - public function setDescriptionRaw(string $desc) : void - { - $this->descriptionRaw = $desc; - } - /** * {@inheritdoc} */ diff --git a/Theme/Backend/Components/DepartmentTagSelector/DepartmentTagSelectorView.php b/Theme/Backend/Components/DepartmentTagSelector/DepartmentTagSelectorView.php index 6085114..89c10f7 100755 --- a/Theme/Backend/Components/DepartmentTagSelector/DepartmentTagSelectorView.php +++ b/Theme/Backend/Components/DepartmentTagSelector/DepartmentTagSelectorView.php @@ -44,7 +44,7 @@ class DepartmentTagSelectorView extends View * @var string * @since 1.0.0 */ - private string $name = ''; + public string $name = ''; /** * Is required @@ -78,18 +78,6 @@ class DepartmentTagSelectorView extends View return $this->id; } - /** - * Get name - * - * @return string - * - * @since 1.0.0 - */ - public function getName() : string - { - return $this->name; - } - /** * Is required? * diff --git a/Theme/Backend/Components/DepartmentTagSelector/department-selector.tpl.php b/Theme/Backend/Components/DepartmentTagSelector/department-selector.tpl.php index f40d03c..2f0e895 100755 --- a/Theme/Backend/Components/DepartmentTagSelector/department-selector.tpl.php +++ b/Theme/Backend/Components/DepartmentTagSelector/department-selector.tpl.php @@ -40,7 +40,7 @@