Commit a146e47c authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

Refactoring pour retirer dépendance SignatureFlowStep sur l'entité ProcessStep

parent 50ee646f
Loading
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -85,6 +85,7 @@ CREATE TABLE public.unicaen_signature_process (
	status int4 NULL,
	document_name varchar(255) NOT NULL,
	currentstep int4 NOT NULL,
    label varchar(255) NULL DEFAULT NULL::character varying,
    CONSTRAINT unicaen_signature_process_pkey PRIMARY KEY (id),
	CONSTRAINT fk_994855d2b4090c8a FOREIGN KEY (signatureflow_id) REFERENCES unicaen_signature_signatureflow(id)
);
@@ -131,13 +132,12 @@ CREATE TABLE public.unicaen_signature_process_step (
	id int4 NOT NULL,
	process_id int4 NULL,
	signature_id int4 NULL,
	signatureflowstep_id int4 NULL,
    label varchar(255) NULL DEFAULT NULL::character varying,

    CONSTRAINT unicaen_signature_process_step_pkey PRIMARY KEY (id),
	CONSTRAINT fk_cf70b0a57ec2f574 FOREIGN KEY (process_id) REFERENCES unicaen_signature_process(id),
	CONSTRAINT fk_cf70b0a5c352c4 FOREIGN KEY (signatureflowstep_id) REFERENCES unicaen_signature_signatureflowstep(id),
	CONSTRAINT fk_cf70b0a5ed61183a FOREIGN KEY (signature_id) REFERENCES unicaen_signature_signature(id)
);
CREATE INDEX idx_cf70b0a57ec2f574 ON public.unicaen_signature_process_step USING btree (process_id);
CREATE INDEX idx_cf70b0a5c352c4 ON public.unicaen_signature_process_step USING btree (signatureflowstep_id);
CREATE UNIQUE INDEX uniq_cf70b0a5ed61183a ON public.unicaen_signature_process_step USING btree (signature_id);
```
 No newline at end of file
+2 −3
Original line number Diff line number Diff line
@@ -100,6 +100,7 @@ CREATE TABLE unicaen_signature_process
    status           int4 NULL,
    currentstep      int4         NOT NULL,
    document_name    varchar(255) NOT NULL,
    label varchar(255) NULL DEFAULT NULL::character varying,
    signatureflow_id int4 NULL,
    CONSTRAINT unicaen_signature_process_pkey PRIMARY KEY (id),
    CONSTRAINT fk_994855d2b4090c8a FOREIGN KEY (signatureflow_id) REFERENCES unicaen_signature_signatureflow (id)
@@ -112,14 +113,12 @@ CREATE TABLE unicaen_signature_process_step
    id                   int4 NOT NULL,
    process_id           int4 NULL,
    signature_id         int4 NULL,
    signatureflowstep_id int4 NULL,
    label varchar(255) NULL DEFAULT NULL::character varying,
    CONSTRAINT unicaen_signature_process_step_pkey PRIMARY KEY (id),
    CONSTRAINT fk_cf70b0a57ec2f574 FOREIGN KEY (process_id) REFERENCES unicaen_signature_process (id),
    CONSTRAINT fk_cf70b0a5c352c4 FOREIGN KEY (signatureflowstep_id) REFERENCES unicaen_signature_signatureflowstep (id),
    CONSTRAINT fk_cf70b0a5ed61183a FOREIGN KEY (signature_id) REFERENCES unicaen_signature_signature (id)
);
CREATE INDEX idx_cf70b0a57ec2f574 ON unicaen_signature_process_step USING btree (process_id);
CREATE INDEX idx_cf70b0a5c352c4 ON unicaen_signature_process_step USING btree (signatureflowstep_id);
CREATE UNIQUE INDEX uniq_cf70b0a5ed61183a ON unicaen_signature_process_step USING btree (signature_id);

-- Sequences
+22 −5
Original line number Diff line number Diff line
@@ -54,6 +54,14 @@ class Process
     */
    protected int $currentStep = 0;

    /**
     * Label du process issu du SignatureFlow
     *
     * @var ?string
     * @ORM\Column (type="text", nullable=true)
     */
    private ?string $label;

    /**
     * @var SignatureFlow
     * @ORM\ManyToOne(targetEntity="SignatureFlow")
@@ -181,6 +189,20 @@ class Process
        return $this;
    }


    public function getLabel(): ?string
    {
        return $this->label;
    }

    public function setLabel(?string $label): ?string
    {
        $this->label = $label;

        return $this;
    }


    /**
     * @return SignatureFlow
     */
@@ -232,11 +254,6 @@ class Process
        );
    }

    public function getLabel(): string
    {
        return $this->getSignatureFlow()->getLabel();
    }

    public function isInProgress(): bool
    {
        return $this->getStatus() == Signature::STATUS_SIGNATURE_WAIT;
+15 −19
Original line number Diff line number Diff line
@@ -32,11 +32,15 @@ class ProcessStep
     */
    private Signature $signature;


    /**
     * @var SignatureFlowStep
     * @ORM\ManyToOne(targetEntity="SignatureFlowStep")
     * Label de l'étape du process issu du SignatureFlowStep
     *
     * @var ?string
     * @ORM\Column (type="text", nullable=true)
     */
    private SignatureFlowStep $signatureFlowStep;
    private ?string $label;


    /**
     * @return int
@@ -89,23 +93,17 @@ class ProcessStep
        return $this;
    }

    /**
     * @return SignatureFlowStep
     */
    public function getSignatureFlowStep(): SignatureFlowStep
    {
        return $this->signatureFlowStep;
    }
    public function setLabel($label) :ProcessStep {
        $this->label = $label;

    /**
     * @param SignatureFlowStep $signatureFlowStep
     */
    public function setSignatureFlowStep(SignatureFlowStep $signatureFlowStep): self
    {
        $this->signatureFlowStep = $signatureFlowStep;
        return $this;
    }

    public function getLabel() :string {
        return $this->label;
    }


    /**
     * @return int
     */
@@ -114,9 +112,7 @@ class ProcessStep
        return $this->getSignature()->getOrder();
    }

    public function getLabel() :string {
        return $this->getSignatureFlowStep()->getLabel();
    }


    public function getLetterfileName() :string {
        return $this->getSignature()->getLetterfileKey();
+2 −2
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ class ProcessService
        SignatureConfigurationServiceAwareTrait,
        SignatureServiceAwareTrait;


    /**
     * @return ProcessRepository
     */
@@ -188,8 +189,7 @@ class ProcessService
            // Création des étapes
            $processStep = new ProcessStep();
            $this->getObjectManager()->persist($processStep);

            $processStep->setSignatureFlowStep($signatureFlowStep);
            $processStep->setLabel($signatureFlowStep->getLabel());
            $processStep->setProcess($process);
            $process->getSteps()->add($processStep);