fix(structure): Correct case-sensitivity for Linux compatibility
Rename folders to match PHP PSR-4 autoloading conventions: - schemas → Schemas - shared → Shared - Wordpress → WordPress (in all locations) Fixes deployment issues on Linux servers where filesystem is case-sensitive. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ROITheme\Shared\Application\UseCases\DeleteComponent;
|
||||
|
||||
/**
|
||||
* DeleteComponentRequest - DTO para eliminar componente
|
||||
*
|
||||
* @package ROITheme\Shared\Application\UseCases\DeleteComponent
|
||||
*/
|
||||
final readonly class DeleteComponentRequest
|
||||
{
|
||||
public function __construct(
|
||||
private string $componentName
|
||||
) {}
|
||||
|
||||
public function getComponentName(): string
|
||||
{
|
||||
return $this->componentName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ROITheme\Shared\Application\UseCases\DeleteComponent;
|
||||
|
||||
/**
|
||||
* DeleteComponentResponse - DTO de respuesta para eliminación
|
||||
*
|
||||
* @package ROITheme\Shared\Application\UseCases\DeleteComponent
|
||||
*/
|
||||
final readonly class DeleteComponentResponse
|
||||
{
|
||||
private function __construct(
|
||||
private bool $success,
|
||||
private ?string $message,
|
||||
private ?string $error
|
||||
) {}
|
||||
|
||||
public function isSuccess(): bool
|
||||
{
|
||||
return $this->success;
|
||||
}
|
||||
|
||||
public function getMessage(): ?string
|
||||
{
|
||||
return $this->message;
|
||||
}
|
||||
|
||||
public function getError(): ?string
|
||||
{
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
public static function success(string $message): self
|
||||
{
|
||||
return new self(true, $message, null);
|
||||
}
|
||||
|
||||
public static function failure(string $error): self
|
||||
{
|
||||
return new self(false, null, $error);
|
||||
}
|
||||
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'success' => $this->success,
|
||||
'message' => $this->message,
|
||||
'error' => $this->error
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ROITheme\Shared\Application\UseCases\DeleteComponent;
|
||||
|
||||
use ROITheme\Shared\Domain\Contracts\ComponentRepositoryInterface;
|
||||
use ROITheme\Shared\Domain\Contracts\CacheServiceInterface;
|
||||
use ROITheme\Shared\Domain\ValueObjects\ComponentName;
|
||||
|
||||
/**
|
||||
* DeleteComponentUseCase - Eliminar componente
|
||||
*
|
||||
* RESPONSABILIDAD: Orquestar eliminación de componente
|
||||
*
|
||||
* FLUJO:
|
||||
* 1. Verificar que existe
|
||||
* 2. Eliminar de BD
|
||||
* 3. Invalidar cache
|
||||
* 4. Retornar confirmación
|
||||
*
|
||||
* @package ROITheme\Shared\Application\UseCases\DeleteComponent
|
||||
*/
|
||||
final class DeleteComponentUseCase
|
||||
{
|
||||
public function __construct(
|
||||
private ComponentRepositoryInterface $repository,
|
||||
private CacheServiceInterface $cache
|
||||
) {}
|
||||
|
||||
public function execute(DeleteComponentRequest $request): DeleteComponentResponse
|
||||
{
|
||||
try {
|
||||
$componentNameString = $request->getComponentName();
|
||||
$componentName = new ComponentName($componentNameString);
|
||||
|
||||
// 1. Verificar que existe
|
||||
$component = $this->repository->findByName($componentName);
|
||||
|
||||
if ($component === null) {
|
||||
return DeleteComponentResponse::failure(
|
||||
"Component '{$componentNameString}' not found"
|
||||
);
|
||||
}
|
||||
|
||||
// 2. Eliminar
|
||||
$deleted = $this->repository->delete($componentName);
|
||||
|
||||
if (!$deleted) {
|
||||
return DeleteComponentResponse::failure(
|
||||
"Failed to delete component '{$componentNameString}'"
|
||||
);
|
||||
}
|
||||
|
||||
// 3. Invalidar cache
|
||||
$this->cache->delete("component_{$componentNameString}");
|
||||
|
||||
// 4. Retornar éxito
|
||||
return DeleteComponentResponse::success(
|
||||
"Component '{$componentNameString}' deleted successfully"
|
||||
);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return DeleteComponentResponse::failure(
|
||||
'Unexpected error: ' . $e->getMessage()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user