refs #723. Delete attribute position

feature/actions
Manuel Aranda Rosales 2024-09-26 12:48:50 +02:00
parent 38674081d9
commit a7c70a287f
4 changed files with 37 additions and 29 deletions

View File

@ -0,0 +1,37 @@
<?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 Version20240926104532 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 organizational_unit DROP FOREIGN KEY FK_749AEB2DC56641EE');
$this->addSql('ALTER TABLE command_group DROP position');
$this->addSql('DROP INDEX IDX_749AEB2DC56641EE ON organizational_unit');
$this->addSql('ALTER TABLE organizational_unit DROP remote_calendar_id');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE organizational_unit ADD remote_calendar_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE organizational_unit ADD CONSTRAINT FK_749AEB2DC56641EE FOREIGN KEY (remote_calendar_id) REFERENCES remote_calendar (id)');
$this->addSql('CREATE INDEX IDX_749AEB2DC56641EE ON organizational_unit (remote_calendar_id)');
$this->addSql('ALTER TABLE command_group ADD position INT NOT NULL');
}
}

View File

@ -30,14 +30,6 @@ final class CommandGroupInput
)]
public array $commands = [];
#[Assert\NotBlank(message: 'validators.command_group.position.not_blank')]
#[Groups(['command-group:write'])]
#[ApiProperty(
description: 'La posición del grupo de comandos',
example: '1',
)]
public ?int $position = null;
#[Groups(['command-group:write'])]
#[ApiProperty(
description: '¿Está habilitado el grupo de comandos?',
@ -59,7 +51,6 @@ final class CommandGroupInput
}
}
$this->position = $commandGroup->getPosition();
$this->enabled = $commandGroup->isEnabled();
}
@ -76,7 +67,6 @@ final class CommandGroupInput
}
$commandGroup->setCommands( $commandsToAdd ?? [] );
$commandGroup->setPosition($this->position);
return $commandGroup;
}

View File

@ -16,9 +16,6 @@ final class CommandGroupOutput extends AbstractOutput
#[Groups(['command-group:read', 'command-task:read'])]
public array $commands = [];
#[Groups(['command-group:read', 'command-task:read'])]
public ?int $position = null;
#[Groups(['command-group:read'])]
public \DateTime $createdAt;
@ -35,7 +32,6 @@ final class CommandGroupOutput extends AbstractOutput
fn(Command $command) => new CommandOutput($command)
)->toArray();
$this->position = $commandGroup->getPosition();
$this->createdAt = $commandGroup->getCreatedAt();
$this->createdBy = $commandGroup->getCreatedBy();
}

View File

@ -19,9 +19,6 @@ class CommandGroup extends AbstractEntity
#[ORM\ManyToMany(targetEntity: Command::class, inversedBy: 'commandGroups')]
private Collection $commands;
#[ORM\Column]
private ?int $position = null;
/**
* @var Collection<int, CommandTask>
*/
@ -70,18 +67,6 @@ class CommandGroup extends AbstractEntity
return $this;
}
public function getPosition(): ?int
{
return $this->position;
}
public function setPosition(int $position): static
{
$this->position = $position;
return $this;
}
/**
* @return Collection<int, CommandTask>
*/