mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 10:33:49 +00:00
Rename membership edition and add more fixtures
This commit is contained in:
@@ -10,7 +10,7 @@ use Chill\PersonBundle\Entity\Person;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
||||
|
||||
class MoveMembers
|
||||
class MembersEditor
|
||||
{
|
||||
private ValidatorInterface $validator;
|
||||
private Household $household;
|
||||
@@ -18,18 +18,12 @@ class MoveMembers
|
||||
private array $persistables = [];
|
||||
private array $memershipsAffected = [];
|
||||
|
||||
public function __construct(ValidatorInterface $validator)
|
||||
public function __construct(ValidatorInterface $validator, Household $household)
|
||||
{
|
||||
$this->validation = $validator;
|
||||
$this->household = $household;
|
||||
}
|
||||
|
||||
public function toHousehold(Household $household): self
|
||||
{
|
||||
$this->household = $household;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function addMovement(\DateTimeInterface $date, Person $person, Position $position, ?bool $holder = false, ?string $comment = null): self
|
||||
{
|
||||
if (NULL === $this->household) {
|
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\PersonBundle\Household;
|
||||
|
||||
use Chill\PersonBundle\Household\MembersEditor;
|
||||
use Chill\PersonBundle\Entity\Household\Household;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
||||
|
||||
class MembersEditorFactory
|
||||
{
|
||||
public function __construct(ValidatorInterface $validator)
|
||||
{
|
||||
$this->validator = $validator;
|
||||
}
|
||||
|
||||
public function createEditor(Household $household): MembersEditor
|
||||
{
|
||||
return new MembersEditor($this->validator, $household);
|
||||
}
|
||||
}
|
@@ -1,27 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\PersonBundle\Household;
|
||||
|
||||
use Chill\PersonBundle\Household\MoveMembers;
|
||||
use Chill\PersonBundle\Entity\Household\Household;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
||||
|
||||
class MoveMembersFactory
|
||||
{
|
||||
public function __construct(ValidatorInterface $validator)
|
||||
{
|
||||
$this->validator = $validator;
|
||||
}
|
||||
|
||||
public function createMovement(?Household $household): MoveMembers
|
||||
{
|
||||
$movement = new MoveMembers($this->validator);
|
||||
|
||||
if ($household) {
|
||||
$movement->toHousehold($household);
|
||||
}
|
||||
|
||||
return $movement;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user