mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
cs: Fix code style (safe rules only).
This commit is contained in:
@@ -1,46 +1,49 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\AMLI\BudgetBundle\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Chill\AMLI\BudgetBundle\Calculator\CalculatorManager;
|
||||
use Chill\AMLI\BudgetBundle\Entity\Charge;
|
||||
use Chill\AMLI\BudgetBundle\Entity\Resource;
|
||||
use Chill\AMLI\BudgetBundle\Security\Authorization\BudgetElementVoter;
|
||||
use Chill\AMLI\BudgetBundle\Calculator\CalculatorManager;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use function array_merge;
|
||||
|
||||
class ElementController extends Controller
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var EntityManagerInterface
|
||||
*/
|
||||
protected $em;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var TranslatorInterface
|
||||
*/
|
||||
protected $translator;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var LoggerInterface
|
||||
*/
|
||||
protected $chillMainLogger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var CalculatorManager
|
||||
*/
|
||||
protected $calculator;
|
||||
|
||||
|
||||
/**
|
||||
* @var LoggerInterface
|
||||
*/
|
||||
protected $chillMainLogger;
|
||||
|
||||
/**
|
||||
* @var EntityManagerInterface
|
||||
*/
|
||||
protected $em;
|
||||
|
||||
/**
|
||||
* @var TranslatorInterface
|
||||
*/
|
||||
protected $translator;
|
||||
|
||||
public function __construct(
|
||||
EntityManagerInterface $em,
|
||||
TranslatorInterface $translator,
|
||||
@@ -52,45 +55,44 @@ class ElementController extends Controller
|
||||
$this->chillMainLogger = $chillMainLogger;
|
||||
$this->calculator = $calculator;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Route(
|
||||
* "{_locale}/budget/elements/by-person/{id}",
|
||||
* name="chill_budget_elements_index"
|
||||
* "{_locale}/budget/elements/by-person/{id}",
|
||||
* name="chill_budget_elements_index"
|
||||
* )
|
||||
*/
|
||||
public function indexAction(Person $person)
|
||||
{
|
||||
$this->denyAccessUnlessGranted(BudgetElementVoter::SHOW, $person);
|
||||
|
||||
|
||||
$charges = $this->em
|
||||
->getRepository(Charge::class)
|
||||
->findByPerson($person);
|
||||
$ressources = $this->em
|
||||
->getRepository(Resource::class)
|
||||
->findByPerson($person);
|
||||
|
||||
$now = new \DateTime('now');
|
||||
|
||||
|
||||
$now = new DateTime('now');
|
||||
|
||||
$actualCharges = $this->em
|
||||
->getRepository(Charge::class)
|
||||
->findByPersonAndDate($person, $now);
|
||||
$actualResources = $this->em
|
||||
->getRepository(Resource::class)
|
||||
->findByPersonAndDate($person, $now);
|
||||
|
||||
$elements = \array_merge($actualCharges, $actualResources);
|
||||
|
||||
|
||||
$elements = array_merge($actualCharges, $actualResources);
|
||||
|
||||
if (count($elements) > 0) {
|
||||
$results = $this->calculator->calculateDefault($elements);
|
||||
}
|
||||
|
||||
return $this->render('ChillAMLIBudgetBundle:Element:index.html.twig', array(
|
||||
|
||||
return $this->render('ChillAMLIBudgetBundle:Element:index.html.twig', [
|
||||
'person' => $person,
|
||||
'charges' => $charges,
|
||||
'resources' => $ressources,
|
||||
'results' => $results ?? []
|
||||
));
|
||||
'results' => $results ?? [],
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user