-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
Reappointment
subdecision for installations in bodies
This adds a new type of organ mutation, a reappointment. This mutation can be used to "prolong" the membership of a member in an organ. The subdecision refers to the original installation, just like a discharge. While a self-reference would have been nice (for consecutive reappointments), it introduces a lot of compexity due to the added recursion. As such, `Reappointment`s have a many-to-one relationship with `Installation`s. `Reappointment`s are processed before `Discharge`s and `Installation`s. In the Organ Mutations UI, only the `Lid` function can be directly reappointed. All other functions can be reappointed by checking the relevant functions in the model. This means that if a function is NOT checked it will not be reappointed, this means that a discharge for this particular function is created. Some of the JavaScript discharge functionality has been moved into a separate function to reduce code duplication. On top of that, the reappointments, discharges, and installations are now also sorted as such in the UI.
- Loading branch information
Showing
13 changed files
with
526 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Database\Model\SubDecision; | ||
|
||
use Database\Model\SubDecision; | ||
use Doctrine\ORM\Mapping\Entity; | ||
use Doctrine\ORM\Mapping\JoinColumn; | ||
use Doctrine\ORM\Mapping\ManyToOne; | ||
|
||
use function sprintf; | ||
|
||
/** | ||
* Reappointment of a previous installation. | ||
* | ||
* To prevent issues with recursive self-references, multiple reappointments can point to the same installation. | ||
*/ | ||
#[Entity] | ||
class Reappointment extends SubDecision | ||
{ | ||
/** | ||
* Reference to the installation of a member. | ||
*/ | ||
#[ManyToOne( | ||
targetEntity: Installation::class, | ||
inversedBy: 'reappointments', | ||
)] | ||
#[JoinColumn( | ||
name: 'r_meeting_type', | ||
referencedColumnName: 'meeting_type', | ||
)] | ||
#[JoinColumn( | ||
name: 'r_meeting_number', | ||
referencedColumnName: 'meeting_number', | ||
)] | ||
#[JoinColumn( | ||
name: 'r_decision_point', | ||
referencedColumnName: 'decision_point', | ||
)] | ||
#[JoinColumn( | ||
name: 'r_decision_number', | ||
referencedColumnName: 'decision_number', | ||
)] | ||
#[JoinColumn( | ||
name: 'r_number', | ||
referencedColumnName: 'number', | ||
)] | ||
protected Installation $installation; | ||
|
||
/** | ||
* Get the original installation for this reappointment. | ||
*/ | ||
public function getInstallation(): Installation | ||
{ | ||
return $this->installation; | ||
} | ||
|
||
/** | ||
* Set the original installation for this reappointment. | ||
*/ | ||
public function setInstallation(Installation $installation): void | ||
{ | ||
$this->installation = $installation; | ||
} | ||
|
||
/** | ||
* Get the textual content of this subdecision. | ||
*/ | ||
public function getContent(): string | ||
{ | ||
$installation = $this->getInstallation(); | ||
$memberFullName = $installation->getMember()->getFullName(); | ||
|
||
return sprintf( | ||
'%s wordt herbenoemd als %s van %s.', | ||
$memberFullName, | ||
$installation->getFunction(), | ||
$installation->getFoundation()->getAbbr(), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.