|
- <?php
-
- namespace Lc\CaracoleBundle\Solver\User;
-
- use Lc\CaracoleBundle\Model\PointSale\PointSaleInterface;
- use Lc\SovBundle\Model\User\UserInterface;
- use Lc\SovBundle\Solver\User\UserSolver as SovUserSolver;
-
- class UserSolver extends SovUserSolver
- {
- // isUserLinkedToPointSale
- public function isLinkedToPointSale(UserInterface $user, PointSaleInterface $pointSale): bool
- {
- foreach ($user->getUserPointSales() as $userPointSale) {
- if ($userPointSale->getPointSale()->getId() == $pointSale->getId()) {
- return true;
- }
- }
-
- return false;
- }
-
-
- public function getAge(UserInterface $user): ?int
- {
- if ($user->getBirthdate()) {
- $now = new \DateTime();
- $interval = $now->diff($user->getBirthdate());
- return $interval->y;
- } else {
- return null;
- }
- }
- }
|