chore: Fix wrong classes naming

Signed-off-by: Rubén D <nuxsmin@syspass.org>
This commit is contained in:
Rubén D
2024-03-09 13:19:02 +01:00
parent ff9bf9f91d
commit d17b50183a
60 changed files with 200 additions and 200 deletions

View File

@@ -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();

View File

@@ -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(),

View File

@@ -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);

View File

@@ -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());

View File

@@ -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;
}

View File

@@ -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'));

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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'));

View File

@@ -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,

View File

@@ -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
{

View File

@@ -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;

View File

@@ -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;

View File

@@ -32,7 +32,7 @@ use SP\Domain\Core\Messages\MessageInterface;
*
* @package SP\DataModel
*/
class NotificationItemWithIdAndName implements ItemWithIdAndNameModel
class Notification implements ItemWithIdAndNameModel
{
/**
* @var int

View File

@@ -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;

View File

@@ -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
{

View File

@@ -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
{

View File

@@ -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
{

View File

@@ -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

View File

@@ -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
*/

View File

@@ -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
*/

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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);
}
}

View File

@@ -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

View File

@@ -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
);
}
}

View File

@@ -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
*/

View File

@@ -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);
}
}

View File

@@ -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

View File

@@ -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),

View File

@@ -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
*/

View File

@@ -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
*/

View File

@@ -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
*/

View File

@@ -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

View File

@@ -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
*/

View File

@@ -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
*/

View File

@@ -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()

View File

@@ -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));
}
}

View File

@@ -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));
}
/**

View File

@@ -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'));

View File

@@ -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);

View File

@@ -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

View File

@@ -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);

View File

@@ -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);
}

View File

@@ -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()
);

View File

@@ -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,

View File

@@ -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 => [

View File

@@ -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]);

View File

@@ -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());
}

View File

@@ -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));
}

View File

@@ -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));
}

View File

@@ -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();

View File

@@ -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)
);
}

View File

@@ -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

View File

@@ -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);

View File

@@ -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());
}
);

View File

@@ -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());
}
);