Skip to content

Commit

Permalink
fix BeneficiaryService & MembershipService
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Dec 24, 2022
1 parent 2e5269e commit 4e84d2c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/AppBundle/Service/BeneficiaryService.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@
use AppBundle\Entity\Registration;
use AppBundle\Entity\Shift;
use AppBundle\Entity\ShiftBucket;
use AppBundle\Service\MembershipService;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Common\Collections\ArrayCollection;
use phpDocumentor\Reflection\Types\Array_;
use Symfony\Component\DependencyInjection\Container;

class BeneficiaryService
{

protected $em;
private $membershipService;

public function __construct($em, $membershipService)
public function __construct(EntityManagerInterface $em, MembershipService $membershipService)
{
$this->em = $em;
$this->membershipService = $membershipService;
Expand Down
6 changes: 2 additions & 4 deletions src/AppBundle/Service/MembershipService.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

class MembershipService
{

protected $em;
protected $registration_duration;
protected $registration_every_civil_year;
Expand Down Expand Up @@ -117,7 +116,7 @@ public function getStartOfCycle(Membership $membership, $cycleOffset = 0)
// Set date to monday of week A
$date->modify('-'. (7 * $week) . ' days');
} else {
$firstDate = $this->getFirstShiftDate();
$firstDate = $membership->getFirstShiftDate();
if ($firstDate) {
$now = new DateTime('now');
$date = clone($firstDate);
Expand All @@ -127,7 +126,7 @@ public function getStartOfCycle(Membership $membership, $cycleOffset = 0)
$currentCycleCount = intval($diff / 28);
$date->modify("+" . (28 * $currentCycleCount) . " days");
}
}else{
} else {
$date = new DateTime('now');
}
}
Expand All @@ -154,5 +153,4 @@ public function getEndOfCycle(Membership $membership, $cycleOffset = 0)
$date->setTime(23, 59, 59);
return $date;
}

}

0 comments on commit 4e84d2c

Please sign in to comment.