diff --git a/app/modules/web/Controllers/AccountFile/UploadController.php b/app/modules/web/Controllers/AccountFile/UploadController.php index 93ff7921..26909e19 100644 --- a/app/modules/web/Controllers/AccountFile/UploadController.php +++ b/app/modules/web/Controllers/AccountFile/UploadController.php @@ -29,7 +29,7 @@ use JsonException; use SP\Core\Application; use SP\Core\Events\Event; use SP\Core\Events\EventMessage; -use SP\DataModel\FileItemWithIdAndName; +use SP\DataModel\File; use SP\Domain\Account\Ports\AccountFileService; use SP\Domain\Account\Ports\AccountService; use SP\Domain\Core\Exceptions\SPException; @@ -92,7 +92,7 @@ final class UploadController extends ControllerBase try { $fileHandler = new FileHandler($file['tmp_name']); - $fileData = new FileItemWithIdAndName(); + $fileData = new File(); $fileData->setAccountId($accountId); $fileData->setName(htmlspecialchars($file['name'], ENT_QUOTES)); $fileData->setSize($file['size']); @@ -161,14 +161,14 @@ final class UploadController extends ControllerBase } /** - * @param FileItemWithIdAndName $fileData + * @param File $fileData * @param FileHandlerInterface $fileHandler * * @return string * @throws SPException * @throws FileException */ - private function checkAllowedMimeType(FileItemWithIdAndName $fileData, FileHandlerInterface $fileHandler): string + private function checkAllowedMimeType(File $fileData, FileHandlerInterface $fileHandler): string { if (in_array($fileData->getType(), $this->configData->getFilesAllowedMime(), true)) { return $fileData->getType(); diff --git a/app/modules/web/Controllers/Items/NotificationsController.php b/app/modules/web/Controllers/Items/NotificationsController.php index 954865f0..3a99674b 100644 --- a/app/modules/web/Controllers/Items/NotificationsController.php +++ b/app/modules/web/Controllers/Items/NotificationsController.php @@ -25,7 +25,7 @@ namespace SP\Modules\Web\Controllers\Items; use SP\Core\Application; -use SP\DataModel\NotificationItemWithIdAndName; +use SP\DataModel\Notification; use SP\Domain\Core\Exceptions\ConstraintException; use SP\Domain\Core\Exceptions\QueryException; use SP\Domain\Core\Exceptions\SPException; @@ -65,7 +65,7 @@ final class NotificationsController extends SimpleControllerBase { $notifications = array_map( static function ($notification) { - /** @@var $notification NotificationItemWithIdAndName */ + /** @@var $notification Notification */ return sprintf( '(%s) - %s', $notification->getComponent(), diff --git a/app/modules/web/Controllers/Notification/NotificationViewBase.php b/app/modules/web/Controllers/Notification/NotificationViewBase.php index 8d62f3f1..dab6499e 100644 --- a/app/modules/web/Controllers/Notification/NotificationViewBase.php +++ b/app/modules/web/Controllers/Notification/NotificationViewBase.php @@ -27,7 +27,7 @@ namespace SP\Modules\Web\Controllers\Notification; use SP\Core\Acl\Acl; use SP\Core\Application; -use SP\DataModel\NotificationItemWithIdAndName; +use SP\DataModel\Notification; use SP\Domain\Core\Acl\AclActionsInterface; use SP\Domain\Core\Exceptions\ConstraintException; use SP\Domain\Core\Exceptions\QueryException; @@ -75,7 +75,7 @@ abstract class NotificationViewBase extends ControllerBase $notification = $notificationId ? $this->notificationService->getById($notificationId) - : new NotificationItemWithIdAndName(); + : new Notification(); $this->view->assign('notification', $notification); diff --git a/app/modules/web/Controllers/UserProfile/UserProfileViewBase.php b/app/modules/web/Controllers/UserProfile/UserProfileViewBase.php index ac7246ac..249a52f4 100644 --- a/app/modules/web/Controllers/UserProfile/UserProfileViewBase.php +++ b/app/modules/web/Controllers/UserProfile/UserProfileViewBase.php @@ -28,7 +28,7 @@ namespace SP\Modules\Web\Controllers\UserProfile; use SP\Core\Acl\Acl; use SP\Core\Application; use SP\DataModel\ProfileData; -use SP\DataModel\UserProfileItemWithIdAndName; +use SP\DataModel\UserProfile; use SP\Domain\Common\Services\ServiceException; use SP\Domain\Core\Acl\AclActionsInterface; use SP\Domain\Core\Exceptions\ConstraintException; @@ -82,7 +82,7 @@ abstract class UserProfileViewBase extends ControllerBase $profile = $profileId ? $this->userProfileService->getById($profileId) - : new UserProfileItemWithIdAndName(); + : new UserProfile(); $this->view->assign('profile', $profile); $this->view->assign('profileData', $profile->getProfile() ?: new ProfileData()); diff --git a/app/modules/web/Forms/NotificationForm.php b/app/modules/web/Forms/NotificationForm.php index c3316baa..a6d288f1 100644 --- a/app/modules/web/Forms/NotificationForm.php +++ b/app/modules/web/Forms/NotificationForm.php @@ -25,7 +25,7 @@ namespace SP\Modules\Web\Forms; use SP\Core\Messages\NotificationMessage; -use SP\DataModel\NotificationItemWithIdAndName; +use SP\DataModel\Notification; use SP\Domain\Core\Acl\AclActionsInterface; use SP\Domain\Core\Exceptions\ValidationException; @@ -36,7 +36,7 @@ use SP\Domain\Core\Exceptions\ValidationException; */ final class NotificationForm extends FormBase implements FormInterface { - protected ?NotificationItemWithIdAndName $notificationData = null; + protected ?Notification $notificationData = null; /** * Validar el formulario @@ -71,7 +71,7 @@ final class NotificationForm extends FormBase implements FormInterface */ protected function analyzeRequestData(): void { - $this->notificationData = new NotificationItemWithIdAndName(); + $this->notificationData = new Notification(); $this->notificationData->setId($this->itemId); $this->notificationData->setType($this->request->analyzeString('notification_type')); $this->notificationData->setComponent($this->request->analyzeString('notification_component')); @@ -113,7 +113,7 @@ final class NotificationForm extends FormBase implements FormInterface } } - public function getItemData(): ?NotificationItemWithIdAndName + public function getItemData(): ?Notification { return $this->notificationData; } diff --git a/app/modules/web/Forms/UserProfileForm.php b/app/modules/web/Forms/UserProfileForm.php index 759ee1a8..76b2588f 100644 --- a/app/modules/web/Forms/UserProfileForm.php +++ b/app/modules/web/Forms/UserProfileForm.php @@ -25,7 +25,7 @@ namespace SP\Modules\Web\Forms; use SP\DataModel\ProfileData; -use SP\DataModel\UserProfileItemWithIdAndName; +use SP\DataModel\UserProfile; use SP\Domain\Core\Acl\AclActionsInterface; use SP\Domain\Core\Exceptions\SPException; use SP\Domain\Core\Exceptions\ValidationException; @@ -37,7 +37,7 @@ use SP\Domain\Core\Exceptions\ValidationException; */ final class UserProfileForm extends FormBase implements FormInterface { - protected ?UserProfileItemWithIdAndName $userProfileData = null; + protected ?UserProfile $userProfileData = null; /** * Validar el formulario @@ -74,7 +74,7 @@ final class UserProfileForm extends FormBase implements FormInterface { $profileData = $this->getProfileDataFromRequest(); - $this->userProfileData = new UserProfileItemWithIdAndName(); + $this->userProfileData = new UserProfile(); $this->userProfileData->setName($this->request->analyzeString('profile_name')); $this->userProfileData->setId($this->itemId); $this->userProfileData->setProfile($profileData); @@ -133,7 +133,7 @@ final class UserProfileForm extends FormBase implements FormInterface /** * @throws SPException */ - public function getItemData(): UserProfileItemWithIdAndName + public function getItemData(): UserProfile { if (null === $this->userProfileData) { throw new SPException(__u('Profile data not set')); diff --git a/app/modules/web/themes/material-blue/views/account/files-list.inc b/app/modules/web/themes/material-blue/views/account/files-list.inc index 0c4a2158..10c6f286 100644 --- a/app/modules/web/themes/material-blue/views/account/files-list.inc +++ b/app/modules/web/themes/material-blue/views/account/files-list.inc @@ -26,10 +26,10 @@ * @var ThemeIconsInterface $icons * @var callable $_getvar * @var ConfigDataInterface $configData - * @var FileItemWithIdAndName $file + * @var File $file */ -use SP\DataModel\FileItemWithIdAndName; +use SP\DataModel\File; use SP\Domain\Config\Ports\ConfigDataInterface; use SP\Domain\Core\UI\ThemeIconsInterface; use SP\Html\Html; diff --git a/app/modules/web/themes/material-blue/views/itemshow/file.inc b/app/modules/web/themes/material-blue/views/itemshow/file.inc index b47d53e6..b9ceaa73 100644 --- a/app/modules/web/themes/material-blue/views/itemshow/file.inc +++ b/app/modules/web/themes/material-blue/views/itemshow/file.inc @@ -23,14 +23,14 @@ */ /** - * @var FileItemWithIdAndName $fileData + * @var File $fileData * @var ThemeIconsInterface $icons * @var ConfigDataInterface $configData * @var callable $_getvar * @var TemplateInterface $this */ -use SP\DataModel\FileItemWithIdAndName; +use SP\DataModel\File; use SP\Domain\Config\Ports\ConfigDataInterface; use SP\Domain\Core\UI\ThemeIconsInterface; use SP\Mvc\View\TemplateInterface; diff --git a/app/modules/web/themes/material-blue/views/itemshow/user_profile.inc b/app/modules/web/themes/material-blue/views/itemshow/user_profile.inc index e5558eb9..abeaeccf 100644 --- a/app/modules/web/themes/material-blue/views/itemshow/user_profile.inc +++ b/app/modules/web/themes/material-blue/views/itemshow/user_profile.inc @@ -24,7 +24,7 @@ /** * @var ProfileData $profileData - * @var UserProfileItemWithIdAndName $profile + * @var UserProfile $profile * @var ThemeIconsInterface $icons * @var ConfigDataInterface $configData * @var callable $_getvar @@ -32,7 +32,7 @@ */ use SP\DataModel\ProfileData; -use SP\DataModel\UserProfileItemWithIdAndName; +use SP\DataModel\UserProfile; use SP\Domain\Config\Ports\ConfigDataInterface; use SP\Domain\Core\UI\ThemeIconsInterface; use SP\Mvc\View\TemplateInterface; diff --git a/app/modules/web/themes/material-blue/views/notification/notification.inc b/app/modules/web/themes/material-blue/views/notification/notification.inc index 3d08506e..79196f40 100644 --- a/app/modules/web/themes/material-blue/views/notification/notification.inc +++ b/app/modules/web/themes/material-blue/views/notification/notification.inc @@ -23,14 +23,14 @@ */ /** - * @var NotificationItemWithIdAndName $notification + * @var Notification $notification * @var ThemeIconsInterface $icons * @var ConfigDataInterface $configData * @var callable $_getvar * @var TemplateInterface $this */ -use SP\DataModel\NotificationItemWithIdAndName; +use SP\DataModel\Notification; use SP\Domain\Config\Ports\ConfigDataInterface; use SP\Domain\Core\UI\ThemeIconsInterface; use SP\Mvc\View\Components\SelectItem; diff --git a/lib/SP/Core/Acl/Actions.php b/lib/SP/Core/Acl/Actions.php index 80cfcaec..0c118d2e 100644 --- a/lib/SP/Core/Acl/Actions.php +++ b/lib/SP/Core/Acl/Actions.php @@ -24,7 +24,7 @@ namespace SP\Core\Acl; -use SP\DataModel\ActionItemWithIdAndName; +use SP\DataModel\Action; use SP\Domain\Core\Acl\ActionNotFoundException; use SP\Domain\Core\Acl\ActionsInterface; use SP\Domain\Storage\Ports\FileCacheService; @@ -49,7 +49,7 @@ class Actions implements ActionsInterface */ public const CACHE_EXPIRE = 86400; /** - * @var ActionItemWithIdAndName[]|null + * @var Action[]|null */ protected ?array $actions = null; @@ -113,14 +113,14 @@ class Actions implements ActionsInterface $this->actions = []; foreach ($this->load() as $a) { - $this->actions[$a['id']] = new ActionItemWithIdAndName($a['id'], $a['name'], $a['text'], $a['route']); + $this->actions[$a['id']] = new Action($a['id'], $a['name'], $a['text'], $a['route']); } } /** * Loads actions from DB * - * @return ActionItemWithIdAndName[] + * @return Action[] * @throws FileException */ protected function load(): array @@ -147,7 +147,7 @@ class Actions implements ActionsInterface * * @throws ActionNotFoundException */ - public function getActionById(int $id): ActionItemWithIdAndName + public function getActionById(int $id): Action { if (!isset($this->actions[$id])) { throw new ActionNotFoundException(__u('Action not found')); diff --git a/lib/SP/DataModel/ActionItemWithIdAndName.php b/lib/SP/DataModel/Action.php similarity index 95% rename from lib/SP/DataModel/ActionItemWithIdAndName.php rename to lib/SP/DataModel/Action.php index 65eaa9a5..eb41c5fa 100644 --- a/lib/SP/DataModel/ActionItemWithIdAndName.php +++ b/lib/SP/DataModel/Action.php @@ -31,7 +31,7 @@ use SP\Domain\Common\Models\ItemWithIdAndNameModel; * * @package SP\DataModel */ -class ActionItemWithIdAndName implements ItemWithIdAndNameModel +class Action implements ItemWithIdAndNameModel { public function __construct( private readonly int $id, diff --git a/lib/SP/DataModel/FileItemWithIdAndName.php b/lib/SP/DataModel/File.php similarity index 95% rename from lib/SP/DataModel/FileItemWithIdAndName.php rename to lib/SP/DataModel/File.php index 7e1712e4..1494f83a 100644 --- a/lib/SP/DataModel/FileItemWithIdAndName.php +++ b/lib/SP/DataModel/File.php @@ -32,7 +32,7 @@ use SP\Domain\Common\Models\Model; * * @package SP\DataModel */ -class FileItemWithIdAndName extends Model implements ItemWithIdAndNameModel +class File extends Model implements ItemWithIdAndNameModel { protected ?int $id = null; protected ?int $accountId = null; @@ -79,7 +79,7 @@ class FileItemWithIdAndName extends Model implements ItemWithIdAndNameModel } /** - * @param string $thumb + * @param string $thumb */ public function setThumb(string $thumb): void { diff --git a/lib/SP/DataModel/FileExtData.php b/lib/SP/DataModel/FileExtData.php index 6018f854..c60ff6c5 100644 --- a/lib/SP/DataModel/FileExtData.php +++ b/lib/SP/DataModel/FileExtData.php @@ -29,7 +29,7 @@ namespace SP\DataModel; * * @package SP\DataModel */ -class FileExtData extends FileItemWithIdAndName +class FileExtData extends File { protected ?string $clientName = null; protected ?string $accountName = null; diff --git a/lib/SP/DataModel/ItemItemWithIdAndName.php b/lib/SP/DataModel/Item.php similarity index 94% rename from lib/SP/DataModel/ItemItemWithIdAndName.php rename to lib/SP/DataModel/Item.php index 480fdfb8..98df3506 100644 --- a/lib/SP/DataModel/ItemItemWithIdAndName.php +++ b/lib/SP/DataModel/Item.php @@ -32,7 +32,7 @@ use SP\Domain\Common\Models\Model; * * @package SP\DataModel */ -class ItemItemWithIdAndName extends Model implements ItemWithIdAndNameModel +class Item extends Model implements ItemWithIdAndNameModel { protected ?int $id = null; protected ?string $name = null; diff --git a/lib/SP/DataModel/NotificationItemWithIdAndName.php b/lib/SP/DataModel/Notification.php similarity index 98% rename from lib/SP/DataModel/NotificationItemWithIdAndName.php rename to lib/SP/DataModel/Notification.php index 18f7077b..17e31abc 100644 --- a/lib/SP/DataModel/NotificationItemWithIdAndName.php +++ b/lib/SP/DataModel/Notification.php @@ -32,7 +32,7 @@ use SP\Domain\Core\Messages\MessageInterface; * * @package SP\DataModel */ -class NotificationItemWithIdAndName implements ItemWithIdAndNameModel +class Notification implements ItemWithIdAndNameModel { /** * @var int diff --git a/lib/SP/DataModel/UserProfileItemWithIdAndName.php b/lib/SP/DataModel/UserProfile.php similarity index 94% rename from lib/SP/DataModel/UserProfileItemWithIdAndName.php rename to lib/SP/DataModel/UserProfile.php index 6e782b2a..04c28a34 100644 --- a/lib/SP/DataModel/UserProfileItemWithIdAndName.php +++ b/lib/SP/DataModel/UserProfile.php @@ -34,7 +34,7 @@ defined('APP_ROOT') || die(); * * @package SP\DataModel */ -class UserProfileItemWithIdAndName extends Model implements ItemWithIdAndNameModel +class UserProfile extends Model implements ItemWithIdAndNameModel { protected ?int $id = null; protected ?string $name = null; diff --git a/lib/SP/Domain/Account/Adapters/AccountSearchItem.php b/lib/SP/Domain/Account/Adapters/AccountSearchItem.php index 69ff8e6a..c03cce8d 100644 --- a/lib/SP/Domain/Account/Adapters/AccountSearchItem.php +++ b/lib/SP/Domain/Account/Adapters/AccountSearchItem.php @@ -25,7 +25,7 @@ namespace SP\Domain\Account\Adapters; use SP\Core\Bootstrap\BootstrapBase; -use SP\DataModel\ItemItemWithIdAndName; +use SP\DataModel\Item; use SP\Domain\Account\Models\AccountSearchView; use SP\Domain\Account\Services\PublicLink; use SP\Domain\Common\Dtos\ItemDataTrait; @@ -246,7 +246,7 @@ final class AccountSearchItem } /** - * @return ItemItemWithIdAndName[] + * @return Item[] */ public function getTags(): array { diff --git a/lib/SP/Domain/Account/Dtos/AccountAclDto.php b/lib/SP/Domain/Account/Dtos/AccountAclDto.php index db4c257a..928666d4 100644 --- a/lib/SP/Domain/Account/Dtos/AccountAclDto.php +++ b/lib/SP/Domain/Account/Dtos/AccountAclDto.php @@ -24,7 +24,7 @@ namespace SP\Domain\Account\Dtos; -use SP\DataModel\ItemItemWithIdAndName; +use SP\DataModel\Item; use SP\Domain\Account\Models\AccountSearchView; use SP\Domain\Common\Dtos\ItemDataTrait; @@ -110,7 +110,7 @@ final class AccountAclDto } /** - * @return ItemItemWithIdAndName[] + * @return Item[] */ public function getUsersId(): array { @@ -118,7 +118,7 @@ final class AccountAclDto } /** - * @return ItemItemWithIdAndName[] + * @return Item[] */ public function getUserGroupsId(): array { diff --git a/lib/SP/Domain/Account/Dtos/AccountEnrichedDto.php b/lib/SP/Domain/Account/Dtos/AccountEnrichedDto.php index 090f51e6..a4832c6d 100644 --- a/lib/SP/Domain/Account/Dtos/AccountEnrichedDto.php +++ b/lib/SP/Domain/Account/Dtos/AccountEnrichedDto.php @@ -24,7 +24,7 @@ namespace SP\Domain\Account\Dtos; -use SP\DataModel\ItemItemWithIdAndName; +use SP\DataModel\Item; use SP\Domain\Account\Models\AccountView; use SP\Domain\Common\Dtos\ItemDataTrait; @@ -37,15 +37,15 @@ class AccountEnrichedDto private readonly int $id; /** - * @var ItemItemWithIdAndName[] Los usuarios secundarios de la cuenta. + * @var Item[] Los usuarios secundarios de la cuenta. */ private array $users = []; /** - * @var ItemItemWithIdAndName[] Los grupos secundarios de la cuenta. + * @var Item[] Los grupos secundarios de la cuenta. */ private array $userGroups = []; /** - * @var ItemItemWithIdAndName[] Las etiquetas de la cuenta. + * @var Item[] Las etiquetas de la cuenta. */ private array $tags = []; @@ -68,7 +68,7 @@ class AccountEnrichedDto } /** - * @param ItemItemWithIdAndName[] $users + * @param Item[] $users * * @return AccountEnrichedDto */ @@ -81,7 +81,7 @@ class AccountEnrichedDto } /** - * @param ItemItemWithIdAndName[] $groups + * @param Item[] $groups * * @return AccountEnrichedDto */ @@ -94,7 +94,7 @@ class AccountEnrichedDto } /** - * @param ItemItemWithIdAndName[] $tags + * @param Item[] $tags * * @return AccountEnrichedDto */ @@ -107,7 +107,7 @@ class AccountEnrichedDto } /** - * @return ItemItemWithIdAndName[] + * @return Item[] */ public function getUsers(): array { @@ -115,7 +115,7 @@ class AccountEnrichedDto } /** - * @return ItemItemWithIdAndName[] + * @return Item[] */ public function getUserGroups(): array { @@ -123,7 +123,7 @@ class AccountEnrichedDto } /** - * @return ItemItemWithIdAndName[] + * @return Item[] */ public function getTags(): array { diff --git a/lib/SP/Domain/Account/Ports/AccountFileRepository.php b/lib/SP/Domain/Account/Ports/AccountFileRepository.php index df0ee8f0..56e1c45e 100644 --- a/lib/SP/Domain/Account/Ports/AccountFileRepository.php +++ b/lib/SP/Domain/Account/Ports/AccountFileRepository.php @@ -24,7 +24,7 @@ namespace SP\Domain\Account\Ports; -use SP\DataModel\FileItemWithIdAndName; +use SP\DataModel\File; use SP\DataModel\ItemSearchData; use SP\Domain\Common\Ports\Repository; use SP\Domain\Core\Exceptions\ConstraintException; @@ -41,13 +41,13 @@ interface AccountFileRepository extends Repository /** * Creates an item * - * @param FileItemWithIdAndName $fileData + * @param File $fileData * * @return int * @throws ConstraintException * @throws QueryException */ - public function create(FileItemWithIdAndName $fileData): int; + public function create(File $fileData): int; /** * Returns the item for given id diff --git a/lib/SP/Domain/Account/Ports/AccountFileService.php b/lib/SP/Domain/Account/Ports/AccountFileService.php index dbcc55dd..d8d6b68b 100644 --- a/lib/SP/Domain/Account/Ports/AccountFileService.php +++ b/lib/SP/Domain/Account/Ports/AccountFileService.php @@ -24,8 +24,8 @@ namespace SP\Domain\Account\Ports; +use SP\DataModel\File; use SP\DataModel\FileExtData; -use SP\DataModel\FileItemWithIdAndName; use SP\DataModel\ItemSearchData; use SP\Domain\Common\Services\ServiceException; use SP\Domain\Core\Exceptions\ConstraintException; @@ -48,7 +48,7 @@ interface AccountFileService * @throws ConstraintException * @throws QueryException */ - public function create(FileItemWithIdAndName $itemData): int; + public function create(File $itemData): int; /** * Returns the item for given id @@ -92,7 +92,7 @@ interface AccountFileService /** * Returns the item for given id * - * @return FileItemWithIdAndName[] + * @return File[] * @throws ConstraintException * @throws QueryException */ diff --git a/lib/SP/Domain/Account/Ports/AccountToTagService.php b/lib/SP/Domain/Account/Ports/AccountToTagService.php index dc86b7bd..e5f5e718 100644 --- a/lib/SP/Domain/Account/Ports/AccountToTagService.php +++ b/lib/SP/Domain/Account/Ports/AccountToTagService.php @@ -24,7 +24,7 @@ namespace SP\Domain\Account\Ports; -use SP\DataModel\ItemItemWithIdAndName; +use SP\DataModel\Item; use SP\Domain\Core\Exceptions\ConstraintException; use SP\Domain\Core\Exceptions\QueryException; @@ -36,7 +36,7 @@ use SP\Domain\Core\Exceptions\QueryException; interface AccountToTagService { /** - * @return ItemItemWithIdAndName[] + * @return Item[] * @throws ConstraintException * @throws QueryException */ diff --git a/lib/SP/Domain/Account/Ports/AccountToUserGroupService.php b/lib/SP/Domain/Account/Ports/AccountToUserGroupService.php index 9c532eb8..31125c9a 100644 --- a/lib/SP/Domain/Account/Ports/AccountToUserGroupService.php +++ b/lib/SP/Domain/Account/Ports/AccountToUserGroupService.php @@ -24,7 +24,7 @@ namespace SP\Domain\Account\Ports; -use SP\DataModel\ItemItemWithIdAndName; +use SP\DataModel\Item; use SP\Domain\Core\Exceptions\ConstraintException; use SP\Domain\Core\Exceptions\QueryException; use SP\Domain\Core\Exceptions\SPException; @@ -37,7 +37,7 @@ interface AccountToUserGroupService /** * @param int $id * - * @return ItemItemWithIdAndName[] + * @return Item[] * @throws ConstraintException * @throws QueryException * @throws SPException diff --git a/lib/SP/Domain/Account/Ports/AccountToUserService.php b/lib/SP/Domain/Account/Ports/AccountToUserService.php index c1be77c6..79d74428 100644 --- a/lib/SP/Domain/Account/Ports/AccountToUserService.php +++ b/lib/SP/Domain/Account/Ports/AccountToUserService.php @@ -24,7 +24,7 @@ namespace SP\Domain\Account\Ports; -use SP\DataModel\ItemItemWithIdAndName; +use SP\DataModel\Item; use SP\Domain\Core\Exceptions\ConstraintException; use SP\Domain\Core\Exceptions\QueryException; use SP\Domain\Core\Exceptions\SPException; @@ -37,7 +37,7 @@ interface AccountToUserService /** * @param int $id * - * @return ItemItemWithIdAndName[] + * @return Item[] * @throws ConstraintException * @throws QueryException * @throws SPException diff --git a/lib/SP/Domain/Account/Services/AccountFile.php b/lib/SP/Domain/Account/Services/AccountFile.php index 8972b072..06915349 100644 --- a/lib/SP/Domain/Account/Services/AccountFile.php +++ b/lib/SP/Domain/Account/Services/AccountFile.php @@ -25,8 +25,8 @@ namespace SP\Domain\Account\Services; use SP\Core\Application; +use SP\DataModel\File; use SP\DataModel\FileExtData; -use SP\DataModel\FileItemWithIdAndName; use SP\DataModel\ItemSearchData; use SP\Domain\Account\Ports\AccountFileRepository; use SP\Domain\Account\Ports\AccountFileService; @@ -62,14 +62,14 @@ final class AccountFile extends Service implements AccountFileService /** * Creates an item * - * @param FileItemWithIdAndName $itemData + * @param File $itemData * * @return int * @throws ConstraintException * @throws InvalidImageException * @throws QueryException */ - public function create(FileItemWithIdAndName $itemData): int + public function create(File $itemData): int { if (FileUtil::isImage($itemData)) { $itemData->setThumb($this->imageUtil->createThumbnail($itemData->getContent())); @@ -152,7 +152,7 @@ final class AccountFile extends Service implements AccountFileService * Returns the item for given id * * @param int $id - * @return FileItemWithIdAndName[] + * @return File[] * @throws ConstraintException * @throws QueryException * @throws SPException diff --git a/lib/SP/Domain/Account/Services/AccountToTag.php b/lib/SP/Domain/Account/Services/AccountToTag.php index 96091618..d9db5f00 100644 --- a/lib/SP/Domain/Account/Services/AccountToTag.php +++ b/lib/SP/Domain/Account/Services/AccountToTag.php @@ -25,7 +25,7 @@ namespace SP\Domain\Account\Services; use SP\Core\Application; -use SP\DataModel\ItemItemWithIdAndName; +use SP\DataModel\Item; use SP\Domain\Account\Ports\AccountToTagRepository; use SP\Domain\Account\Ports\AccountToTagService; use SP\Domain\Common\Models\Simple; @@ -52,7 +52,7 @@ final class AccountToTag extends Service implements AccountToTagService /** * @param int $id * - * @return ItemItemWithIdAndName[] + * @return Item[] * * @throws ConstraintException * @throws QueryException @@ -64,6 +64,6 @@ final class AccountToTag extends Service implements AccountToTagService ->getTagsByAccountId($id) ->getDataAsArray(Simple::class); - return array_map(fn($tag) => ItemItemWithIdAndName::buildFromSimpleModel($tag), $tags); + return array_map(fn($tag) => Item::buildFromSimpleModel($tag), $tags); } } diff --git a/lib/SP/Domain/Account/Services/AccountToUser.php b/lib/SP/Domain/Account/Services/AccountToUser.php index 619ed288..f3198ebe 100644 --- a/lib/SP/Domain/Account/Services/AccountToUser.php +++ b/lib/SP/Domain/Account/Services/AccountToUser.php @@ -25,7 +25,7 @@ namespace SP\Domain\Account\Services; use SP\Core\Application; -use SP\DataModel\ItemItemWithIdAndName; +use SP\DataModel\Item; use SP\Domain\Account\Ports\AccountToUserRepository; use SP\Domain\Account\Ports\AccountToUserService; use SP\Domain\Common\Services\Service; @@ -48,7 +48,7 @@ final class AccountToUser extends Service implements AccountToUserService /** * @param int $id * - * @return ItemItemWithIdAndName[] + * @return Item[] * @throws ConstraintException * @throws QueryException * @throws SPException diff --git a/lib/SP/Domain/Account/Services/AccountToUserGroup.php b/lib/SP/Domain/Account/Services/AccountToUserGroup.php index 391a1741..2074e7f9 100644 --- a/lib/SP/Domain/Account/Services/AccountToUserGroup.php +++ b/lib/SP/Domain/Account/Services/AccountToUserGroup.php @@ -25,7 +25,7 @@ namespace SP\Domain\Account\Services; use SP\Core\Application; -use SP\DataModel\ItemItemWithIdAndName; +use SP\DataModel\Item; use SP\Domain\Account\Ports\AccountToUserGroupRepository; use SP\Domain\Account\Ports\AccountToUserGroupService; use SP\Domain\Common\Services\Service; @@ -48,7 +48,7 @@ final class AccountToUserGroup extends Service implements AccountToUserGroupServ /** * @param int $id * - * @return ItemItemWithIdAndName[] + * @return Item[] * @throws ConstraintException * @throws QueryException * @throws SPException @@ -56,7 +56,7 @@ final class AccountToUserGroup extends Service implements AccountToUserGroupServ public function getUserGroupsByAccountId(int $id): array { return $this->accountToUserGroupRepository->getUserGroupsByAccountId($id)->getDataAsArray( - ItemItemWithIdAndName::class + Item::class ); } } diff --git a/lib/SP/Domain/Client/Ports/ClientService.php b/lib/SP/Domain/Client/Ports/ClientService.php index 81e41301..090a713e 100644 --- a/lib/SP/Domain/Client/Ports/ClientService.php +++ b/lib/SP/Domain/Client/Ports/ClientService.php @@ -24,7 +24,7 @@ namespace SP\Domain\Client\Ports; -use SP\DataModel\ItemItemWithIdAndName; +use SP\DataModel\Item; use SP\DataModel\ItemSearchData; use SP\Domain\Client\Models\Client; use SP\Domain\Common\Services\ServiceException; @@ -106,7 +106,7 @@ interface ClientService /** * Returns all clients visible for a given user * - * @return ItemItemWithIdAndName[] + * @return Item[] * @throws QueryException * @throws ConstraintException */ diff --git a/lib/SP/Domain/Common/Dtos/ItemDataTrait.php b/lib/SP/Domain/Common/Dtos/ItemDataTrait.php index 6b17a9b7..6ed2cfab 100644 --- a/lib/SP/Domain/Common/Dtos/ItemDataTrait.php +++ b/lib/SP/Domain/Common/Dtos/ItemDataTrait.php @@ -24,7 +24,7 @@ namespace SP\Domain\Common\Dtos; -use SP\DataModel\ItemItemWithIdAndName; +use SP\DataModel\Item; /** * Trait ItemDataTrait @@ -32,12 +32,12 @@ use SP\DataModel\ItemItemWithIdAndName; trait ItemDataTrait { /** - * @param ItemItemWithIdAndName[] $items + * @param Item[] $items * * @return array */ private static function buildFromItemData(array $items): array { - return array_filter($items, static fn($value) => $value instanceof ItemItemWithIdAndName); + return array_filter($items, static fn($value) => $value instanceof Item); } } diff --git a/lib/SP/Domain/Core/Acl/ActionsInterface.php b/lib/SP/Domain/Core/Acl/ActionsInterface.php index f7d34b71..1254abd8 100644 --- a/lib/SP/Domain/Core/Acl/ActionsInterface.php +++ b/lib/SP/Domain/Core/Acl/ActionsInterface.php @@ -24,7 +24,7 @@ namespace SP\Domain\Core\Acl; -use SP\DataModel\ActionItemWithIdAndName; +use SP\DataModel\Action; use SP\Infrastructure\File\FileException; /** @@ -37,7 +37,7 @@ interface ActionsInterface * * @throws ActionNotFoundException */ - public function getActionById(int $id): ActionItemWithIdAndName; + public function getActionById(int $id): Action; /** * @throws FileException diff --git a/lib/SP/Domain/Install/Services/InstallerService.php b/lib/SP/Domain/Install/Services/InstallerService.php index 7c1d837c..5429a352 100644 --- a/lib/SP/Domain/Install/Services/InstallerService.php +++ b/lib/SP/Domain/Install/Services/InstallerService.php @@ -29,7 +29,7 @@ use Exception; use SP\Core\Crypt\Hash; use SP\DataModel\ProfileData; use SP\DataModel\User; -use SP\DataModel\UserProfileItemWithIdAndName; +use SP\DataModel\UserProfile; use SP\Domain\Config\Models\Config; use SP\Domain\Config\Ports\ConfigDataInterface; use SP\Domain\Config\Ports\ConfigFileService; @@ -344,7 +344,7 @@ final class InstallerService implements InstallerServiceInterface ] ); - $userProfile = new UserProfileItemWithIdAndName(['name' => 'Admin', 'profile' => new ProfileData()]); + $userProfile = new UserProfile(['name' => 'Admin', 'profile' => new ProfileData()]); $userData = new User([ 'userGroupId' => $this->userGroupService->create($userGroup), diff --git a/lib/SP/Domain/Notification/Ports/NotificationServiceInterface.php b/lib/SP/Domain/Notification/Ports/NotificationServiceInterface.php index 2a81e4ce..0bdf9510 100644 --- a/lib/SP/Domain/Notification/Ports/NotificationServiceInterface.php +++ b/lib/SP/Domain/Notification/Ports/NotificationServiceInterface.php @@ -25,7 +25,7 @@ namespace SP\Domain\Notification\Ports; use SP\DataModel\ItemSearchData; -use SP\DataModel\NotificationItemWithIdAndName; +use SP\DataModel\Notification; use SP\Domain\Common\Services\ServiceException; use SP\Domain\Core\Exceptions\ConstraintException; use SP\Domain\Core\Exceptions\QueryException; @@ -45,7 +45,7 @@ interface NotificationServiceInterface * @throws ConstraintException * @throws QueryException */ - public function create(NotificationItemWithIdAndName $itemData): int; + public function create(Notification $itemData): int; /** * Updates an item @@ -53,14 +53,14 @@ interface NotificationServiceInterface * @throws ConstraintException * @throws QueryException */ - public function update(NotificationItemWithIdAndName $itemData): int; + public function update(Notification $itemData): int; /** * Devolver los elementos con los ids especificados * * @param int[] $ids * - * @return NotificationItemWithIdAndName[] + * @return Notification[] * @throws ConstraintException * @throws QueryException */ @@ -113,12 +113,12 @@ interface NotificationServiceInterface * @throws QueryException * @throws NoSuchItemException */ - public function getById(int $id): NotificationItemWithIdAndName; + public function getById(int $id): Notification; /** * Returns all the items * - * @return NotificationItemWithIdAndName[] + * @return Notification[] * @throws ConstraintException * @throws QueryException */ @@ -136,21 +136,21 @@ interface NotificationServiceInterface /** * Devolver las notificaciones de un usuario para una fecha y componente determinados * - * @return NotificationItemWithIdAndName[] + * @return Notification[] * @throws ConstraintException * @throws QueryException */ public function getForUserIdByDate(string $component, int $id): array; /** - * @return NotificationItemWithIdAndName[] + * @return Notification[] * @throws ConstraintException * @throws QueryException */ public function getAllForUserId(int $id): array; /** - * @return NotificationItemWithIdAndName[] + * @return Notification[] * @throws ConstraintException * @throws QueryException */ diff --git a/lib/SP/Domain/Notification/Services/NotificationService.php b/lib/SP/Domain/Notification/Services/NotificationService.php index e4ce4e4a..9216c5fd 100644 --- a/lib/SP/Domain/Notification/Services/NotificationService.php +++ b/lib/SP/Domain/Notification/Services/NotificationService.php @@ -26,7 +26,7 @@ namespace SP\Domain\Notification\Services; use SP\Core\Application; use SP\DataModel\ItemSearchData; -use SP\DataModel\NotificationItemWithIdAndName; +use SP\DataModel\Notification; use SP\Domain\Common\Services\Service; use SP\Domain\Common\Services\ServiceException; use SP\Domain\Core\Exceptions\ConstraintException; @@ -60,7 +60,7 @@ final class NotificationService extends Service implements NotificationServiceIn * @throws ConstraintException * @throws QueryException */ - public function create(NotificationItemWithIdAndName $itemData): int + public function create(Notification $itemData): int { return $this->notificationRepository->create($itemData)->getLastId(); } @@ -71,7 +71,7 @@ final class NotificationService extends Service implements NotificationServiceIn * @throws ConstraintException * @throws QueryException */ - public function update(NotificationItemWithIdAndName $itemData): int + public function update(Notification $itemData): int { return $this->notificationRepository->update($itemData); } @@ -81,7 +81,7 @@ final class NotificationService extends Service implements NotificationServiceIn * * @param int[] $ids * - * @return NotificationItemWithIdAndName[] + * @return Notification[] * @throws ConstraintException * @throws QueryException */ @@ -175,7 +175,7 @@ final class NotificationService extends Service implements NotificationServiceIn * @throws QueryException * @throws NoSuchItemException */ - public function getById(int $id): NotificationItemWithIdAndName + public function getById(int $id): Notification { $result = $this->notificationRepository->getById($id); @@ -189,7 +189,7 @@ final class NotificationService extends Service implements NotificationServiceIn /** * Returns all the items * - * @return NotificationItemWithIdAndName[] + * @return Notification[] * @throws ConstraintException * @throws QueryException */ @@ -215,7 +215,7 @@ final class NotificationService extends Service implements NotificationServiceIn /** * Devolver las notificaciones de un usuario para una fecha y componente determinados * - * @return NotificationItemWithIdAndName[] + * @return Notification[] * @throws ConstraintException * @throws QueryException */ @@ -225,7 +225,7 @@ final class NotificationService extends Service implements NotificationServiceIn } /** - * @return NotificationItemWithIdAndName[] + * @return Notification[] * @throws ConstraintException * @throws QueryException */ @@ -235,7 +235,7 @@ final class NotificationService extends Service implements NotificationServiceIn } /** - * @return NotificationItemWithIdAndName[] + * @return Notification[] * @throws ConstraintException * @throws QueryException */ diff --git a/lib/SP/Domain/Plugin/Ports/PluginManagerInterface.php b/lib/SP/Domain/Plugin/Ports/PluginManagerInterface.php index 54a0a760..dc7bb7c4 100644 --- a/lib/SP/Domain/Plugin/Ports/PluginManagerInterface.php +++ b/lib/SP/Domain/Plugin/Ports/PluginManagerInterface.php @@ -24,7 +24,7 @@ namespace SP\Domain\Plugin\Ports; -use SP\DataModel\ItemItemWithIdAndName; +use SP\DataModel\Item; use SP\DataModel\ItemSearchData; use SP\Domain\Core\Exceptions\ConstraintException; use SP\Domain\Core\Exceptions\QueryException; @@ -169,7 +169,7 @@ interface PluginManagerInterface /** * Devolver los plugins activados * - * @return ItemItemWithIdAndName[] + * @return Item[] * @throws ConstraintException * @throws QueryException */ diff --git a/lib/SP/Domain/Plugin/Services/PluginManager.php b/lib/SP/Domain/Plugin/Services/PluginManager.php index b15b5eeb..909c0f07 100644 --- a/lib/SP/Domain/Plugin/Services/PluginManager.php +++ b/lib/SP/Domain/Plugin/Services/PluginManager.php @@ -25,7 +25,7 @@ namespace SP\Domain\Plugin\Services; use SP\Core\Application; -use SP\DataModel\ItemItemWithIdAndName; +use SP\DataModel\Item; use SP\DataModel\ItemSearchData; use SP\Domain\Common\Services\Service; use SP\Domain\Common\Services\ServiceException; @@ -264,7 +264,7 @@ final class PluginManager extends Service implements PluginManagerInterface /** * Devolver los plugins activados * - * @return ItemItemWithIdAndName[] + * @return Item[] * @throws ConstraintException * @throws QueryException * @throws SPException diff --git a/lib/SP/Domain/User/Ports/UserProfileServiceInterface.php b/lib/SP/Domain/User/Ports/UserProfileServiceInterface.php index 0ea72488..186348c2 100644 --- a/lib/SP/Domain/User/Ports/UserProfileServiceInterface.php +++ b/lib/SP/Domain/User/Ports/UserProfileServiceInterface.php @@ -25,7 +25,7 @@ namespace SP\Domain\User\Ports; use SP\DataModel\ItemSearchData; -use SP\DataModel\UserProfileItemWithIdAndName; +use SP\DataModel\UserProfile; use SP\Domain\Common\Services\ServiceException; use SP\Domain\Core\Exceptions\ConstraintException; use SP\Domain\Core\Exceptions\QueryException; @@ -45,7 +45,7 @@ interface UserProfileServiceInterface * @throws QueryException * @throws NoSuchItemException */ - public function getById(int $id): UserProfileItemWithIdAndName; + public function getById(int $id): UserProfile; /** * @throws ConstraintException @@ -74,7 +74,7 @@ interface UserProfileServiceInterface * @throws QueryException * @throws DuplicatedItemException */ - public function create(UserProfileItemWithIdAndName $itemData): int; + public function create(UserProfile $itemData): int; /** * @throws ConstraintException @@ -82,7 +82,7 @@ interface UserProfileServiceInterface * @throws DuplicatedItemException * @throws ServiceException */ - public function update(UserProfileItemWithIdAndName $itemData): void; + public function update(UserProfile $itemData): void; /** * @throws ConstraintException @@ -93,7 +93,7 @@ interface UserProfileServiceInterface /** * Get all items from the service's repository * - * @return UserProfileItemWithIdAndName[] + * @return UserProfile[] * @throws ConstraintException * @throws QueryException */ diff --git a/lib/SP/Domain/User/Services/UserProfileService.php b/lib/SP/Domain/User/Services/UserProfileService.php index e0ebb3c7..2c7ede81 100644 --- a/lib/SP/Domain/User/Services/UserProfileService.php +++ b/lib/SP/Domain/User/Services/UserProfileService.php @@ -27,7 +27,7 @@ namespace SP\Domain\User\Services; use SP\Core\Application; use SP\DataModel\ItemSearchData; use SP\DataModel\ProfileData; -use SP\DataModel\UserProfileItemWithIdAndName; +use SP\DataModel\UserProfile; use SP\Domain\Common\Services\Service; use SP\Domain\Common\Services\ServiceException; use SP\Domain\Common\Services\ServiceItemTrait; @@ -67,7 +67,7 @@ final class UserProfileService extends Service implements UserProfileServiceInte * @throws QueryException * @throws NoSuchItemException */ - public function getById(int $id): UserProfileItemWithIdAndName + public function getById(int $id): UserProfile { $result = $this->userProfileRepository->getById($id); @@ -130,7 +130,7 @@ final class UserProfileService extends Service implements UserProfileServiceInte * @throws QueryException * @throws DuplicatedItemException */ - public function create(UserProfileItemWithIdAndName $itemData): int + public function create(UserProfile $itemData): int { return $this->userProfileRepository->create($itemData); } @@ -141,7 +141,7 @@ final class UserProfileService extends Service implements UserProfileServiceInte * @throws DuplicatedItemException * @throws ServiceException */ - public function update(UserProfileItemWithIdAndName $itemData): void + public function update(UserProfile $itemData): void { $update = $this->userProfileRepository->update($itemData); @@ -163,7 +163,7 @@ final class UserProfileService extends Service implements UserProfileServiceInte /** * Get all items from the service's repository * - * @return UserProfileItemWithIdAndName[] + * @return UserProfile[] * @throws ConstraintException * @throws QueryException */ diff --git a/lib/SP/Infrastructure/Account/Repositories/AccountFile.php b/lib/SP/Infrastructure/Account/Repositories/AccountFile.php index 86b3ebe5..39fbac7c 100644 --- a/lib/SP/Infrastructure/Account/Repositories/AccountFile.php +++ b/lib/SP/Infrastructure/Account/Repositories/AccountFile.php @@ -24,7 +24,7 @@ namespace SP\Infrastructure\Account\Repositories; -use SP\DataModel\FileItemWithIdAndName; +use SP\DataModel\File; use SP\DataModel\ItemSearchData; use SP\Domain\Account\Ports\AccountFileRepository; use SP\Domain\Core\Exceptions\ConstraintException; @@ -48,13 +48,13 @@ final class AccountFile extends BaseRepository implements AccountFileRepository /** * Creates an item * - * @param FileItemWithIdAndName $fileData + * @param File $fileData * * @return int * @throws ConstraintException * @throws QueryException */ - public function create(FileItemWithIdAndName $fileData): int + public function create(File $fileData): int { $query = $this->queryFactory ->newInsert() diff --git a/lib/SP/Infrastructure/Account/Repositories/AccountToUser.php b/lib/SP/Infrastructure/Account/Repositories/AccountToUser.php index 45e23280..4d25dd40 100644 --- a/lib/SP/Infrastructure/Account/Repositories/AccountToUser.php +++ b/lib/SP/Infrastructure/Account/Repositories/AccountToUser.php @@ -24,7 +24,7 @@ namespace SP\Infrastructure\Account\Repositories; -use SP\DataModel\ItemItemWithIdAndName; +use SP\DataModel\Item; use SP\Domain\Account\Ports\AccountToUserRepository; use SP\Domain\Core\Exceptions\ConstraintException; use SP\Domain\Core\Exceptions\QueryException; @@ -150,6 +150,6 @@ final class AccountToUser extends BaseRepository implements AccountToUserReposit ->bindValues(['accountId' => $id]) ->orderBy(['User.name ASC']); - return $this->db->doSelect(QueryData::build($query)->setMapClassName(ItemItemWithIdAndName::class)); + return $this->db->doSelect(QueryData::build($query)->setMapClassName(Item::class)); } } diff --git a/lib/SP/Infrastructure/Account/Repositories/AccountToUserGroup.php b/lib/SP/Infrastructure/Account/Repositories/AccountToUserGroup.php index be8f3ac3..f0108b82 100644 --- a/lib/SP/Infrastructure/Account/Repositories/AccountToUserGroup.php +++ b/lib/SP/Infrastructure/Account/Repositories/AccountToUserGroup.php @@ -24,7 +24,7 @@ namespace SP\Infrastructure\Account\Repositories; -use SP\DataModel\ItemItemWithIdAndName; +use SP\DataModel\Item; use SP\Domain\Account\Ports\AccountToUserGroupRepository; use SP\Domain\Core\Exceptions\ConstraintException; use SP\Domain\Core\Exceptions\QueryException; @@ -67,7 +67,7 @@ final class AccountToUserGroup extends BaseRepository implements AccountToUserGr ->bindValues(['accountId' => $id]) ->orderBy(['UserGroup.name ASC']); - return $this->db->doSelect(QueryData::build($query)->setMapClassName(ItemItemWithIdAndName::class)); + return $this->db->doSelect(QueryData::build($query)->setMapClassName(Item::class)); } /** @@ -92,7 +92,7 @@ final class AccountToUserGroup extends BaseRepository implements AccountToUserGr ->bindValues(['userGroupId' => $id]) ->orderBy(['UserGroup.name ASC']); - return $this->db->doSelect(QueryData::build($query)->setMapClassName(ItemItemWithIdAndName::class)); + return $this->db->doSelect(QueryData::build($query)->setMapClassName(Item::class)); } /** diff --git a/lib/SP/Infrastructure/Notification/Repositories/NotificationBaseRepository.php b/lib/SP/Infrastructure/Notification/Repositories/NotificationBaseRepository.php index b4a3143e..a388e898 100644 --- a/lib/SP/Infrastructure/Notification/Repositories/NotificationBaseRepository.php +++ b/lib/SP/Infrastructure/Notification/Repositories/NotificationBaseRepository.php @@ -26,7 +26,7 @@ namespace SP\Infrastructure\Notification\Repositories; use RuntimeException; use SP\DataModel\ItemSearchData; -use SP\DataModel\NotificationItemWithIdAndName; +use SP\DataModel\Notification; use SP\Domain\Core\Exceptions\ConstraintException; use SP\Domain\Core\Exceptions\QueryException; use SP\Domain\Notification\Ports\NotificationRepository; @@ -48,7 +48,7 @@ final class NotificationBaseRepository extends BaseRepository implements Notific /** * Creates an item * - * @param NotificationItemWithIdAndName $itemData + * @param Notification $itemData * * @return QueryResult * @throws ConstraintException @@ -85,7 +85,7 @@ final class NotificationBaseRepository extends BaseRepository implements Notific /** * Updates an item * - * @param NotificationItemWithIdAndName $itemData + * @param Notification $itemData * * @return int * @throws ConstraintException @@ -208,7 +208,7 @@ final class NotificationBaseRepository extends BaseRepository implements Notific WHERE id = ? LIMIT 1'; $queryData = new QueryData(); - $queryData->setMapClassName(NotificationItemWithIdAndName::class); + $queryData->setMapClassName(Notification::class); $queryData->setQuery($query); $queryData->addParam($id); $queryData->setOnErrorMessage(__u('Error while retrieving notification')); @@ -239,7 +239,7 @@ final class NotificationBaseRepository extends BaseRepository implements Notific ORDER BY id'; $queryData = new QueryData(); - $queryData->setMapClassName(NotificationItemWithIdAndName::class); + $queryData->setMapClassName(Notification::class); $queryData->setQuery($query); $queryData->setOnErrorMessage(__u('Error while retrieving the notifications')); @@ -276,7 +276,7 @@ final class NotificationBaseRepository extends BaseRepository implements Notific ORDER BY id'; $queryData = new QueryData(); - $queryData->setMapClassName(NotificationItemWithIdAndName::class); + $queryData->setMapClassName(Notification::class); $queryData->setQuery($query); $queryData->setParams($ids); @@ -350,7 +350,7 @@ final class NotificationBaseRepository extends BaseRepository implements Notific public function search(ItemSearchData $itemSearchData): QueryResult { $queryData = new QueryData(); - $queryData->setMapClassName(NotificationItemWithIdAndName::class); + $queryData->setMapClassName(Notification::class); $queryData->setSelect('id, type, component, description, `date`, checked, userId, sticky, onlyAdmin'); $queryData->setFrom('Notification'); $queryData->setOrder('`date` DESC'); @@ -387,7 +387,7 @@ final class NotificationBaseRepository extends BaseRepository implements Notific int $userId ): QueryResult { $queryData = new QueryData(); - $queryData->setMapClassName(NotificationItemWithIdAndName::class); + $queryData->setMapClassName(Notification::class); $queryData->setSelect('id, type, component, description, `date`, checked, userId, sticky, onlyAdmin'); $queryData->setFrom('Notification'); $queryData->setOrder('`date` DESC'); @@ -434,7 +434,7 @@ final class NotificationBaseRepository extends BaseRepository implements Notific int $userId ): QueryResult { $queryData = new QueryData(); - $queryData->setMapClassName(NotificationItemWithIdAndName::class); + $queryData->setMapClassName(Notification::class); $queryData->setSelect('id, type, component, description, `date`, checked, userId, sticky, onlyAdmin'); $queryData->setFrom('Notification'); $queryData->setOrder('`date` DESC'); @@ -518,7 +518,7 @@ final class NotificationBaseRepository extends BaseRepository implements Notific ORDER BY id'; $queryData = new QueryData(); - $queryData->setMapClassName(NotificationItemWithIdAndName::class); + $queryData->setMapClassName(Notification::class); $queryData->setQuery($query); $queryData->setParams([$component, $userId]); $queryData->setOnErrorMessage(__u('Error while retrieving the notifications')); @@ -551,7 +551,7 @@ final class NotificationBaseRepository extends BaseRepository implements Notific ORDER BY `date` DESC '; $queryData = new QueryData(); - $queryData->setMapClassName(NotificationItemWithIdAndName::class); + $queryData->setMapClassName(Notification::class); $queryData->setQuery($query); $queryData->addParam($id); $queryData->setOnErrorMessage(__u('Error while retrieving the notifications')); @@ -585,7 +585,7 @@ final class NotificationBaseRepository extends BaseRepository implements Notific ORDER BY `date` DESC '; $queryData = new QueryData(); - $queryData->setMapClassName(NotificationItemWithIdAndName::class); + $queryData->setMapClassName(Notification::class); $queryData->setQuery($query); $queryData->addParam($id); $queryData->setOnErrorMessage(__u('Error while retrieving the notifications')); @@ -618,7 +618,7 @@ final class NotificationBaseRepository extends BaseRepository implements Notific ORDER BY `date` DESC '; $queryData = new QueryData(); - $queryData->setMapClassName(NotificationItemWithIdAndName::class); + $queryData->setMapClassName(Notification::class); $queryData->setQuery($query); $queryData->addParam($id); $queryData->setOnErrorMessage(__u('Error while retrieving the notifications')); diff --git a/lib/SP/Infrastructure/Plugin/Repositories/PluginBaseRepository.php b/lib/SP/Infrastructure/Plugin/Repositories/PluginBaseRepository.php index d81c5808..957d0156 100644 --- a/lib/SP/Infrastructure/Plugin/Repositories/PluginBaseRepository.php +++ b/lib/SP/Infrastructure/Plugin/Repositories/PluginBaseRepository.php @@ -25,7 +25,7 @@ namespace SP\Infrastructure\Plugin\Repositories; use RuntimeException; -use SP\DataModel\ItemItemWithIdAndName; +use SP\DataModel\Item; use SP\DataModel\ItemSearchData; use SP\Domain\Core\Exceptions\ConstraintException; use SP\Domain\Core\Exceptions\QueryException; @@ -82,7 +82,7 @@ final class PluginBaseRepository extends BaseRepository implements PluginReposit public function getEnabled(): QueryResult { $queryData = new QueryData(); - $queryData->setMapClassName(ItemItemWithIdAndName::class); + $queryData->setMapClassName(Item::class); $queryData->setQuery('SELECT id, `name` FROM Plugin WHERE enabled = 1 ORDER BY id'); return $this->db->doSelect($queryData); diff --git a/lib/SP/Infrastructure/User/Repositories/UserProfileBaseRepository.php b/lib/SP/Infrastructure/User/Repositories/UserProfileBaseRepository.php index 070c41e4..b2030055 100644 --- a/lib/SP/Infrastructure/User/Repositories/UserProfileBaseRepository.php +++ b/lib/SP/Infrastructure/User/Repositories/UserProfileBaseRepository.php @@ -25,7 +25,7 @@ namespace SP\Infrastructure\User\Repositories; use SP\DataModel\ItemSearchData; -use SP\DataModel\UserProfileItemWithIdAndName; +use SP\DataModel\UserProfile; use SP\Domain\Core\Exceptions\ConstraintException; use SP\Domain\Core\Exceptions\QueryException; use SP\Domain\User\Ports\UserProfileRepository; @@ -111,7 +111,7 @@ final class UserProfileBaseRepository extends BaseRepository implements UserProf public function getById(int $id): QueryResult { $queryData = new QueryData(); - $queryData->setMapClassName(UserProfileItemWithIdAndName::class); + $queryData->setMapClassName(UserProfile::class); $queryData->setQuery('SELECT id, `name`, `profile` FROM UserProfile WHERE id = ? LIMIT 1'); $queryData->addParam($id); @@ -128,7 +128,7 @@ final class UserProfileBaseRepository extends BaseRepository implements UserProf public function getAll(): QueryResult { $queryData = new QueryData(); - $queryData->setMapClassName(UserProfileItemWithIdAndName::class); + $queryData->setMapClassName(UserProfile::class); $queryData->setQuery('SELECT id, `name` FROM UserProfile ORDER BY `name`'); return $this->db->doSelect($queryData); @@ -153,7 +153,7 @@ final class UserProfileBaseRepository extends BaseRepository implements UserProf 'SELECT id, `name` FROM UserProfile WHERE id IN ('.$this->buildParamsFromArray($ids).')'; $queryData = new QueryData(); - $queryData->setMapClassName(UserProfileItemWithIdAndName::class); + $queryData->setMapClassName(UserProfile::class); $queryData->setQuery($query); $queryData->setParams($ids); @@ -217,7 +217,7 @@ final class UserProfileBaseRepository extends BaseRepository implements UserProf /** * Creates an item * - * @param UserProfileItemWithIdAndName $itemData + * @param UserProfile $itemData * * @return int * @throws ConstraintException @@ -244,7 +244,7 @@ final class UserProfileBaseRepository extends BaseRepository implements UserProf /** * Checks whether the item is duplicated on adding * - * @param UserProfileItemWithIdAndName $itemData + * @param UserProfile $itemData * * @return bool * @throws ConstraintException @@ -262,7 +262,7 @@ final class UserProfileBaseRepository extends BaseRepository implements UserProf /** * Updates an item * - * @param UserProfileItemWithIdAndName $itemData + * @param UserProfile $itemData * * @return int * @throws ConstraintException @@ -293,7 +293,7 @@ final class UserProfileBaseRepository extends BaseRepository implements UserProf /** * Checks whether the item is duplicated on updating * - * @param UserProfileItemWithIdAndName $itemData + * @param UserProfile $itemData * * @return bool * @throws ConstraintException diff --git a/lib/SP/Providers/Notification/NotificationHandler.php b/lib/SP/Providers/Notification/NotificationHandler.php index 49dececa..75763fb9 100644 --- a/lib/SP/Providers/Notification/NotificationHandler.php +++ b/lib/SP/Providers/Notification/NotificationHandler.php @@ -27,7 +27,7 @@ namespace SP\Providers\Notification; use Exception; use SP\Core\Application; use SP\Core\Events\Event; -use SP\DataModel\NotificationItemWithIdAndName; +use SP\DataModel\Notification; use SP\Domain\Core\Events\EventReceiver; use SP\Domain\Notification\Ports\NotificationServiceInterface; use SP\Providers\EventsTrait; @@ -96,7 +96,7 @@ final class NotificationHandler extends Provider implements EventReceiver $userIds = $eventMessage !== null ? $eventMessage->getExtra('userId') : []; foreach ($userIds as $userId) { - $notificationData = new NotificationItemWithIdAndName(); + $notificationData = new Notification(); $notificationData->setType(__('Request')); $notificationData->setComponent(__('Accounts')); $notificationData->setUserId($userId); @@ -107,9 +107,9 @@ final class NotificationHandler extends Provider implements EventReceiver } /** - * @param NotificationItemWithIdAndName $notificationData + * @param Notification $notificationData */ - private function notify(NotificationItemWithIdAndName $notificationData): void + private function notify(Notification $notificationData): void { try { $this->notificationService->create($notificationData); @@ -129,7 +129,7 @@ final class NotificationHandler extends Provider implements EventReceiver if ($notify[0] === true) { $userId = $eventMessage->getExtra('userId')[0]; - $notificationData = new NotificationItemWithIdAndName(); + $notificationData = new Notification(); $notificationData->setType(__('Notification')); $notificationData->setComponent(__('Accounts')); $notificationData->setUserId($userId); diff --git a/lib/SP/Util/FileUtil.php b/lib/SP/Util/FileUtil.php index db8437d1..72128c2f 100644 --- a/lib/SP/Util/FileUtil.php +++ b/lib/SP/Util/FileUtil.php @@ -27,7 +27,7 @@ namespace SP\Util; use FilesystemIterator; use RecursiveDirectoryIterator; use RecursiveIteratorIterator; -use SP\DataModel\FileItemWithIdAndName; +use SP\DataModel\File; use SP\Domain\Core\Exceptions\FileNotFoundException; use SP\Domain\Core\Exceptions\InvalidClassException; use SP\Infrastructure\File\FileException; @@ -80,7 +80,7 @@ class FileUtil return rmdir($dir); } - public static function isImage(FileItemWithIdAndName $fileData): bool + public static function isImage(File $fileData): bool { return in_array(strtolower($fileData->getType()), self::IMAGE_MIME, true); } diff --git a/tests/SPT/Core/Acl/ActionsTest.php b/tests/SPT/Core/Acl/ActionsTest.php index 9e074e83..c13b84d8 100644 --- a/tests/SPT/Core/Acl/ActionsTest.php +++ b/tests/SPT/Core/Acl/ActionsTest.php @@ -28,7 +28,7 @@ use PHPUnit\Framework\MockObject\Exception; use PHPUnit\Framework\MockObject\MockObject; use SP\Core\Acl\Actions; use SP\Core\Context\ContextException; -use SP\DataModel\ActionItemWithIdAndName; +use SP\DataModel\Action; use SP\Domain\Core\Acl\ActionNotFoundException; use SP\Domain\Storage\Ports\FileCacheService; use SP\Domain\Storage\Ports\XmlFileStorageService; @@ -106,7 +106,7 @@ class ActionsTest extends UnitaryTestCase } /** - * @return ActionItemWithIdAndName[] + * @return Action[] */ private function checkLoadAndSave(): array { @@ -124,7 +124,7 @@ class ActionsTest extends UnitaryTestCase ->willReturn($actions); $actionsMapped = array_map( - static fn(array $a) => new ActionItemWithIdAndName($a['id'], $a['name'], $a['text'], $a['route']), + static fn(array $a) => new Action($a['id'], $a['name'], $a['text'], $a['route']), $actions ); @@ -172,7 +172,7 @@ class ActionsTest extends UnitaryTestCase $actions = $this->getActions(); $actionsMapped = array_map( - static fn(array $a) => new ActionItemWithIdAndName($a['id'], $a['name'], $a['text'], $a['route']), + static fn(array $a) => new Action($a['id'], $a['name'], $a['text'], $a['route']), $actions ); @@ -272,7 +272,7 @@ class ActionsTest extends UnitaryTestCase ->willReturn($actions); $actionsMapped = array_map( - static fn(array $a) => new ActionItemWithIdAndName($a['id'], $a['name'], $a['text'], $a['route']), + static fn(array $a) => new Action($a['id'], $a['name'], $a['text'], $a['route']), $actions ); @@ -292,7 +292,7 @@ class ActionsTest extends UnitaryTestCase public function testGetActionById() { $actionsMapped = array_map( - static fn(array $a) => new ActionItemWithIdAndName($a['id'], $a['name'], $a['text'], $a['route']), + static fn(array $a) => new Action($a['id'], $a['name'], $a['text'], $a['route']), $this->getActions() ); diff --git a/tests/SPT/Domain/Account/Adapters/AccountAdapterTest.php b/tests/SPT/Domain/Account/Adapters/AccountAdapterTest.php index d11b9dc8..4a70fe6b 100644 --- a/tests/SPT/Domain/Account/Adapters/AccountAdapterTest.php +++ b/tests/SPT/Domain/Account/Adapters/AccountAdapterTest.php @@ -27,7 +27,7 @@ namespace SPT\Domain\Account\Adapters; use League\Fractal\Manager; use League\Fractal\Resource\Item; use PHPUnit\Framework\MockObject\Exception; -use SP\DataModel\ActionItemWithIdAndName; +use SP\DataModel\Action; use SP\Domain\Account\Adapters\AccountAdapter; use SP\Domain\Core\Acl\AclActionsInterface; use SP\Domain\Core\Acl\ActionNotFoundException; @@ -57,7 +57,7 @@ class AccountAdapterTest extends UnitaryTestCase ->method('getActionById') ->with(AclActionsInterface::ACCOUNT_VIEW) ->willReturn( - new ActionItemWithIdAndName( + new Action( self::$faker->randomNumber(), self::$faker->colorName, self::$faker->sentence, @@ -140,7 +140,7 @@ class AccountAdapterTest extends UnitaryTestCase ->method('getActionById') ->with(AclActionsInterface::ACCOUNT_VIEW) ->willReturn( - new ActionItemWithIdAndName( + new Action( self::$faker->randomNumber(), self::$faker->colorName, self::$faker->sentence, diff --git a/tests/SPT/Domain/Account/Services/AccountAclTest.php b/tests/SPT/Domain/Account/Services/AccountAclTest.php index 0b39e222..065bdf63 100644 --- a/tests/SPT/Domain/Account/Services/AccountAclTest.php +++ b/tests/SPT/Domain/Account/Services/AccountAclTest.php @@ -26,7 +26,7 @@ namespace SPT\Domain\Account\Services; use PHPUnit\Framework\MockObject\Exception; use SP\Core\Acl\Acl; -use SP\DataModel\ItemItemWithIdAndName; +use SP\DataModel\Item; use SP\Domain\Account\Adapters\AccountPermission; use SP\Domain\Account\Dtos\AccountAclDto; use SP\Domain\Account\Services\AccountAcl; @@ -75,8 +75,8 @@ class AccountAclTest extends UnitaryTestCase 'isPrivateGroup' => 0, 'otherUserGroupEdit' => 0, 'otherUserEdit' => 0, - 'users' => [new ItemItemWithIdAndName(['id' => 3, 'isEdit' => 1])], - 'groups' => [new ItemItemWithIdAndName(['id' => 2, 'isEdit' => 1])], + 'users' => [new Item(['id' => 3, 'isEdit' => 1])], + 'groups' => [new Item(['id' => 2, 'isEdit' => 1])], ], 2 => [ @@ -88,8 +88,8 @@ class AccountAclTest extends UnitaryTestCase 'otherUserEdit' => 0, 'users' => [], 'groups' => [ - new ItemItemWithIdAndName(['id' => 2, 'isEdit' => 1]), - new ItemItemWithIdAndName(['id' => 3, 'isEdit' => 1]), + new Item(['id' => 2, 'isEdit' => 1]), + new Item(['id' => 3, 'isEdit' => 1]), ], ], 3 => [ diff --git a/tests/SPT/Domain/Account/Services/AccountFileTest.php b/tests/SPT/Domain/Account/Services/AccountFileTest.php index 0115434c..5b17ed5d 100644 --- a/tests/SPT/Domain/Account/Services/AccountFileTest.php +++ b/tests/SPT/Domain/Account/Services/AccountFileTest.php @@ -25,8 +25,8 @@ namespace SPT\Domain\Account\Services; use PHPUnit\Framework\MockObject\MockObject; +use SP\DataModel\File; use SP\DataModel\FileExtData; -use SP\DataModel\FileItemWithIdAndName; use SP\Domain\Account\Ports\AccountFileRepository; use SP\Domain\Account\Services\AccountFile; use SP\Domain\Common\Services\ServiceException; @@ -59,8 +59,8 @@ class AccountFileTest extends UnitaryTestCase */ public function testCreate(): void { - $fileData = FileItemWithIdAndName::buildFromSimpleModel(FileDataGenerator::factory()->buildFileData()) - ->mutate( + $fileData = File::buildFromSimpleModel(FileDataGenerator::factory()->buildFileData()) + ->mutate( ['type' => self::$faker->mimeType()] ); @@ -83,7 +83,7 @@ class AccountFileTest extends UnitaryTestCase */ public function testCreateWithThumbnail(): void { - $fileData = FileItemWithIdAndName::buildFromSimpleModel(FileDataGenerator::factory()->buildFileData()); + $fileData = File::buildFromSimpleModel(FileDataGenerator::factory()->buildFileData()); $this->accountFileRepository ->expects(self::once()) @@ -221,7 +221,7 @@ class AccountFileTest extends UnitaryTestCase */ public function testGetByAccountId(): void { - $fileData = FileItemWithIdAndName::buildFromSimpleModel(FileDataGenerator::factory()->buildFileData()); + $fileData = File::buildFromSimpleModel(FileDataGenerator::factory()->buildFileData()); $queryResult = new QueryResult([$fileData]); diff --git a/tests/SPT/Domain/Account/Services/AccountToTagTest.php b/tests/SPT/Domain/Account/Services/AccountToTagTest.php index c7a63c69..919e7ebc 100644 --- a/tests/SPT/Domain/Account/Services/AccountToTagTest.php +++ b/tests/SPT/Domain/Account/Services/AccountToTagTest.php @@ -25,7 +25,7 @@ namespace SPT\Domain\Account\Services; use PHPUnit\Framework\MockObject\MockObject; -use SP\DataModel\ItemItemWithIdAndName; +use SP\DataModel\Item; use SP\Domain\Account\Ports\AccountToTagRepository; use SP\Domain\Account\Services\AccountToTag; use SP\Domain\Common\Models\Simple; @@ -67,7 +67,7 @@ class AccountToTagTest extends UnitaryTestCase $actual = $this->accountToTag->getTagsByAccountId($accountId); $expected = $result->getData(Simple::class)->toArray(null, null, true); - $this->assertTrue($actual[0] instanceof ItemItemWithIdAndName); + $this->assertTrue($actual[0] instanceof Item); $this->assertEquals($expected, $actual[0]->toArray()); } diff --git a/tests/SPT/Domain/Account/Services/AccountToUserGroupTest.php b/tests/SPT/Domain/Account/Services/AccountToUserGroupTest.php index ac8f958c..c4a84489 100644 --- a/tests/SPT/Domain/Account/Services/AccountToUserGroupTest.php +++ b/tests/SPT/Domain/Account/Services/AccountToUserGroupTest.php @@ -25,7 +25,7 @@ namespace SPT\Domain\Account\Services; use PHPUnit\Framework\MockObject\MockObject; -use SP\DataModel\ItemItemWithIdAndName; +use SP\DataModel\Item; use SP\Domain\Account\Ports\AccountToUserGroupRepository; use SP\Domain\Account\Services\AccountToUserGroup; use SP\Domain\Core\Exceptions\ConstraintException; @@ -57,7 +57,7 @@ class AccountToUserGroupTest extends UnitaryTestCase $result = new QueryResult( [ - new ItemItemWithIdAndName( + new Item( [ 'id' => self::$faker->randomNumber(), 'name' => self::$faker->colorName, @@ -74,9 +74,9 @@ class AccountToUserGroupTest extends UnitaryTestCase ->willReturn($result); $actual = $this->accountToUserGroup->getUserGroupsByAccountId($accountId); - $expected = $result->getData(ItemItemWithIdAndName::class)->toArray(null, null, true); + $expected = $result->getData(Item::class)->toArray(null, null, true); - $this->assertTrue($actual[0] instanceof ItemItemWithIdAndName); + $this->assertTrue($actual[0] instanceof Item); $this->assertEquals($expected, $actual[0]->toArray(null, null, true)); } diff --git a/tests/SPT/Domain/Account/Services/AccountToUserTest.php b/tests/SPT/Domain/Account/Services/AccountToUserTest.php index 039ae6f1..04403d1b 100644 --- a/tests/SPT/Domain/Account/Services/AccountToUserTest.php +++ b/tests/SPT/Domain/Account/Services/AccountToUserTest.php @@ -25,7 +25,7 @@ namespace SPT\Domain\Account\Services; use PHPUnit\Framework\MockObject\MockObject; -use SP\DataModel\ItemItemWithIdAndName; +use SP\DataModel\Item; use SP\Domain\Account\Ports\AccountToUserRepository; use SP\Domain\Account\Services\AccountToUser; use SP\Domain\Core\Exceptions\ConstraintException; @@ -57,7 +57,7 @@ class AccountToUserTest extends UnitaryTestCase $result = new QueryResult( [ - new ItemItemWithIdAndName( + new Item( [ 'id' => self::$faker->randomNumber(), 'name' => self::$faker->colorName, @@ -75,9 +75,9 @@ class AccountToUserTest extends UnitaryTestCase ->willReturn($result); $actual = $this->accountToUser->getUsersByAccountId($accountId); - $expected = $result->getData(ItemItemWithIdAndName::class)->toArray(null, null, true); + $expected = $result->getData(Item::class)->toArray(null, null, true); - $this->assertTrue($actual[0] instanceof ItemItemWithIdAndName); + $this->assertTrue($actual[0] instanceof Item); $this->assertEquals($expected, $actual[0]->toArray(null, null, true)); } diff --git a/tests/SPT/Domain/Export/Services/XmlAccountExportTest.php b/tests/SPT/Domain/Export/Services/XmlAccountExportTest.php index 72dc8d77..0ba4d028 100644 --- a/tests/SPT/Domain/Export/Services/XmlAccountExportTest.php +++ b/tests/SPT/Domain/Export/Services/XmlAccountExportTest.php @@ -28,7 +28,7 @@ use DOMDocument; use PHPUnit\Framework\MockObject\Exception; use PHPUnit\Framework\MockObject\MockObject; use RuntimeException; -use SP\DataModel\ItemItemWithIdAndName; +use SP\DataModel\Item; use SP\Domain\Account\Ports\AccountService; use SP\Domain\Account\Ports\AccountToTagService; use SP\Domain\Common\Services\ServiceException; @@ -56,7 +56,7 @@ class XmlAccountExportTest extends UnitaryTestCase public function testExport() { $account = AccountDataGenerator::factory()->buildAccount(); - $tag = new ItemItemWithIdAndName(['id' => self::$faker->randomNumber(3)]); + $tag = new Item(['id' => self::$faker->randomNumber(3)]); $document = new DOMDocument(); diff --git a/tests/SPT/Generators/AccountDataGenerator.php b/tests/SPT/Generators/AccountDataGenerator.php index de8e315e..e2103709 100644 --- a/tests/SPT/Generators/AccountDataGenerator.php +++ b/tests/SPT/Generators/AccountDataGenerator.php @@ -24,7 +24,7 @@ namespace SPT\Generators; -use SP\DataModel\ItemItemWithIdAndName; +use SP\DataModel\Item; use SP\Domain\Account\Dtos\AccountCreateDto; use SP\Domain\Account\Dtos\AccountEnrichedDto; use SP\Domain\Account\Dtos\AccountHistoryDto; @@ -94,12 +94,12 @@ final class AccountDataGenerator extends DataGenerator } /** - * @return ItemItemWithIdAndName[] + * @return Item[] */ public function buildItemData(): array { return array_map( - fn() => new ItemItemWithIdAndName(['id' => $this->faker->randomNumber(3), 'name' => $this->faker->name]), + fn() => new Item(['id' => $this->faker->randomNumber(3), 'name' => $this->faker->name]), range(0, 9) ); } diff --git a/tests/SPT/Generators/UserProfileDataGenerator.php b/tests/SPT/Generators/UserProfileDataGenerator.php index 30ab9360..88f62fae 100644 --- a/tests/SPT/Generators/UserProfileDataGenerator.php +++ b/tests/SPT/Generators/UserProfileDataGenerator.php @@ -25,16 +25,16 @@ namespace SPT\Generators; use SP\DataModel\ProfileData; -use SP\DataModel\UserProfileItemWithIdAndName; +use SP\DataModel\UserProfile; /** * Class UserProfileDataGenerator */ final class UserProfileDataGenerator extends DataGenerator { - public function buildUserProfileData(): UserProfileItemWithIdAndName + public function buildUserProfileData(): UserProfile { - return new UserProfileItemWithIdAndName($this->getUserProfileProperties()); + return new UserProfile($this->getUserProfileProperties()); } private function getUserProfileProperties(): array diff --git a/tests/SPT/Infrastructure/Account/Repositories/AccountFileTest.php b/tests/SPT/Infrastructure/Account/Repositories/AccountFileTest.php index 030bc7b5..374c06dc 100644 --- a/tests/SPT/Infrastructure/Account/Repositories/AccountFileTest.php +++ b/tests/SPT/Infrastructure/Account/Repositories/AccountFileTest.php @@ -27,7 +27,7 @@ namespace SPT\Infrastructure\Account\Repositories; use Aura\SqlQuery\QueryFactory; use PHPUnit\Framework\Constraint\Callback; use PHPUnit\Framework\MockObject\MockObject; -use SP\DataModel\FileItemWithIdAndName; +use SP\DataModel\File; use SP\DataModel\ItemSearchData; use SP\Domain\Common\Models\Simple; use SP\Domain\Core\Exceptions\ConstraintException; @@ -95,7 +95,7 @@ class AccountFileTest extends UnitaryTestCase */ public function testCreate(): void { - $fileData = FileItemWithIdAndName::buildFromSimpleModel(FileDataGenerator::factory()->buildFileData()); + $fileData = File::buildFromSimpleModel(FileDataGenerator::factory()->buildFileData()); $expected = new QueryResult(); $expected->setLastId(1); diff --git a/tests/SPT/Infrastructure/Account/Repositories/AccountToUserGroupTest.php b/tests/SPT/Infrastructure/Account/Repositories/AccountToUserGroupTest.php index 427e7408..5fb9b709 100644 --- a/tests/SPT/Infrastructure/Account/Repositories/AccountToUserGroupTest.php +++ b/tests/SPT/Infrastructure/Account/Repositories/AccountToUserGroupTest.php @@ -27,7 +27,7 @@ namespace SPT\Infrastructure\Account\Repositories; use Aura\SqlQuery\QueryFactory; use PHPUnit\Framework\Constraint\Callback; use PHPUnit\Framework\MockObject\MockObject; -use SP\DataModel\ItemItemWithIdAndName; +use SP\DataModel\Item; use SP\Domain\Core\Exceptions\ConstraintException; use SP\Domain\Core\Exceptions\QueryException; use SP\Infrastructure\Account\Repositories\AccountToUserGroup; @@ -84,7 +84,7 @@ class AccountToUserGroupTest extends UnitaryTestCase $query = $arg->getQuery(); return $query->getBindValues()['accountId'] === $id - && $arg->getMapClassName() === ItemItemWithIdAndName::class + && $arg->getMapClassName() === Item::class && !empty($query->getStatement()); } ); @@ -189,7 +189,7 @@ class AccountToUserGroupTest extends UnitaryTestCase $query = $arg->getQuery(); return $query->getBindValues()['userGroupId'] === $id - && $arg->getMapClassName() === ItemItemWithIdAndName::class + && $arg->getMapClassName() === Item::class && !empty($query->getStatement()); } ); diff --git a/tests/SPT/Infrastructure/Account/Repositories/AccountToUserTest.php b/tests/SPT/Infrastructure/Account/Repositories/AccountToUserTest.php index f9946136..9dd0ffa5 100644 --- a/tests/SPT/Infrastructure/Account/Repositories/AccountToUserTest.php +++ b/tests/SPT/Infrastructure/Account/Repositories/AccountToUserTest.php @@ -27,7 +27,7 @@ namespace SPT\Infrastructure\Account\Repositories; use Aura\SqlQuery\QueryFactory; use PHPUnit\Framework\Constraint\Callback; use PHPUnit\Framework\MockObject\MockObject; -use SP\DataModel\ItemItemWithIdAndName; +use SP\DataModel\Item; use SP\Domain\Core\Exceptions\ConstraintException; use SP\Domain\Core\Exceptions\QueryException; use SP\Infrastructure\Account\Repositories\AccountToUser; @@ -84,7 +84,7 @@ class AccountToUserTest extends UnitaryTestCase $query = $arg->getQuery(); return $query->getBindValues()['accountId'] === $id - && $arg->getMapClassName() === ItemItemWithIdAndName::class + && $arg->getMapClassName() === Item::class && !empty($query->getStatement()); } );