Compare commits
3 Commits
2db9382cb4
...
e447f75544
Author | SHA1 | Date |
---|---|---|
|
e447f75544 | |
|
54cbcef6cb | |
|
edd85e5d99 |
|
@ -1,4 +1,9 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
## [0.24.3] - 2025-09-16
|
||||||
|
### Fixed
|
||||||
|
- Se ha corregido un error a la hora de borrar un repositorio el cual tuviera imagenes.
|
||||||
|
|
||||||
|
---
|
||||||
## [0.24.2] - 2025-09-10
|
## [0.24.2] - 2025-09-10
|
||||||
### Improved
|
### Improved
|
||||||
- Se han realizado mejoras varias sobre la funcionalidad de tareas programadas.
|
- Se han realizado mejoras varias sobre la funcionalidad de tareas programadas.
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace DoctrineMigrations;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
final class Version20250915162242 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this up() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE git_repository DROP FOREIGN KEY FK_C2B3204A50C9D4F7');
|
||||||
|
$this->addSql('ALTER TABLE git_repository ADD CONSTRAINT FK_C2B3204A50C9D4F7 FOREIGN KEY (repository_id) REFERENCES image_repository (id) ON DELETE CASCADE');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE git_repository DROP FOREIGN KEY FK_C2B3204A50C9D4F7');
|
||||||
|
$this->addSql('ALTER TABLE git_repository ADD CONSTRAINT FK_C2B3204A50C9D4F7 FOREIGN KEY (repository_id) REFERENCES image_repository (id)');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace DoctrineMigrations;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
final class Version20250915162434 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this up() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE network_settings DROP FOREIGN KEY FK_48869B5450C9D4F7');
|
||||||
|
$this->addSql('ALTER TABLE network_settings ADD CONSTRAINT FK_48869B5450C9D4F7 FOREIGN KEY (repository_id) REFERENCES image_repository (id) ON DELETE SET NULL');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE network_settings DROP FOREIGN KEY FK_48869B5450C9D4F7');
|
||||||
|
$this->addSql('ALTER TABLE network_settings ADD CONSTRAINT FK_48869B5450C9D4F7 FOREIGN KEY (repository_id) REFERENCES image_repository (id)');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace DoctrineMigrations;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
final class Version20250915162508 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this up() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE client DROP FOREIGN KEY FK_C744045550C9D4F7');
|
||||||
|
$this->addSql('ALTER TABLE client ADD CONSTRAINT FK_C744045550C9D4F7 FOREIGN KEY (repository_id) REFERENCES image_repository (id) ON DELETE SET NULL');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE client DROP FOREIGN KEY FK_C744045550C9D4F7');
|
||||||
|
$this->addSql('ALTER TABLE client ADD CONSTRAINT FK_C744045550C9D4F7 FOREIGN KEY (repository_id) REFERENCES image_repository (id)');
|
||||||
|
}
|
||||||
|
}
|
|
@ -68,6 +68,7 @@ class Client extends AbstractEntity
|
||||||
private ?PxeTemplate $template = null;
|
private ?PxeTemplate $template = null;
|
||||||
|
|
||||||
#[ORM\ManyToOne()]
|
#[ORM\ManyToOne()]
|
||||||
|
#[ORM\JoinColumn(onDelete: 'SET NULL')]
|
||||||
private ?ImageRepository $repository = null;
|
private ?ImageRepository $repository = null;
|
||||||
|
|
||||||
#[ORM\ManyToOne(inversedBy: 'clients')]
|
#[ORM\ManyToOne(inversedBy: 'clients')]
|
||||||
|
|
|
@ -17,6 +17,7 @@ class GitRepository extends AbstractEntity
|
||||||
private ?string $description = null;
|
private ?string $description = null;
|
||||||
|
|
||||||
#[ORM\ManyToOne(inversedBy: 'gitRepositories')]
|
#[ORM\ManyToOne(inversedBy: 'gitRepositories')]
|
||||||
|
#[ORM\JoinColumn(onDelete: 'CASCADE')]
|
||||||
private ?ImageRepository $repository = null;
|
private ?ImageRepository $repository = null;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
|
|
|
@ -28,7 +28,7 @@ class ImageRepository extends AbstractEntity
|
||||||
/**
|
/**
|
||||||
* @var Collection<int, ImageImageRepository>
|
* @var Collection<int, ImageImageRepository>
|
||||||
*/
|
*/
|
||||||
#[ORM\OneToMany(mappedBy: 'repository', targetEntity: ImageImageRepository::class)]
|
#[ORM\OneToMany(mappedBy: 'repository', targetEntity: ImageImageRepository::class, cascade: ['remove'], orphanRemoval: true)]
|
||||||
private Collection $imageImageRepositories;
|
private Collection $imageImageRepositories;
|
||||||
|
|
||||||
#[ORM\Column(length: 255, nullable: true)]
|
#[ORM\Column(length: 255, nullable: true)]
|
||||||
|
|
|
@ -67,6 +67,7 @@ class NetworkSettings extends AbstractEntity
|
||||||
private ?HardwareProfile $hardwareProfile = null;
|
private ?HardwareProfile $hardwareProfile = null;
|
||||||
|
|
||||||
#[ORM\ManyToOne]
|
#[ORM\ManyToOne]
|
||||||
|
#[ORM\JoinColumn(onDelete: 'SET NULL')]
|
||||||
private ?ImageRepository $repository = null;
|
private ?ImageRepository $repository = null;
|
||||||
|
|
||||||
#[ORM\ManyToOne]
|
#[ORM\ManyToOne]
|
||||||
|
|
|
@ -12,13 +12,17 @@ use ApiPlatform\Validator\ValidatorInterface;
|
||||||
use App\Dto\Input\ImageRepositoryInput;
|
use App\Dto\Input\ImageRepositoryInput;
|
||||||
use App\Dto\Output\ImageRepositoryOutput;
|
use App\Dto\Output\ImageRepositoryOutput;
|
||||||
use App\Repository\ImageRepositoryRepository;
|
use App\Repository\ImageRepositoryRepository;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use App\Entity\Client;
|
||||||
|
|
||||||
readonly class ImageRepositoryProcessor implements ProcessorInterface
|
readonly class ImageRepositoryProcessor implements ProcessorInterface
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private ImageRepositoryRepository $imageRepository,
|
private ImageRepositoryRepository $imageRepository,
|
||||||
private ValidatorInterface $validator
|
private ValidatorInterface $validator,
|
||||||
)
|
private EntityManagerInterface $entityManager
|
||||||
|
|
||||||
|
)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,8 +64,17 @@ readonly class ImageRepositoryProcessor implements ProcessorInterface
|
||||||
|
|
||||||
private function processDelete($data, Operation $operation, array $uriVariables = [], array $context = []): null
|
private function processDelete($data, Operation $operation, array $uriVariables = [], array $context = []): null
|
||||||
{
|
{
|
||||||
$user = $this->imageRepository->findOneByUuid($uriVariables['uuid']);
|
$repository = $this->imageRepository->findOneByUuid($uriVariables['uuid']);
|
||||||
$this->imageRepository->delete($user);
|
|
||||||
|
$clients = $this->entityManager->getRepository(Client::class)->findBy(['repository' => $repository]);
|
||||||
|
|
||||||
|
foreach ($clients as $client) {
|
||||||
|
$client->setRepository($client->getOrganizationalUnit()?->getNetworkSettings()?->getRepository());
|
||||||
|
$this->entityManager->persist($client);
|
||||||
|
$this->entityManager->flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->imageRepository->delete($repository);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue