fix how to get task repository

This commit is contained in:
Mathieu Jaumotte 2021-02-12 16:45:24 +01:00
parent 31e1a40cb7
commit 43d12a9647
2 changed files with 14 additions and 14 deletions

View File

@ -148,10 +148,9 @@ class SingleTaskController extends AbstractController
*/
public function showAction(Request $request, $id)
{
/* @var $taskRepository SingleTaskRepository */
$taskRepository = $this->get('chill_task.single_task_repository');
$task = $taskRepository->find($id);
$em = $this->getDoctrine()->getManager();
$task = $em->getRepository(SingleTask::class)->find($id);
if (!is_null($task->getPerson() === !null)) {
$personId = $task->getPerson()->getId();
@ -203,10 +202,9 @@ class SingleTaskController extends AbstractController
$id,
TranslatorInterface $translator
) {
/* @var $taskRepository SingleTaskRepository */
$taskRepository = $this->get('chill_task.single_task_repository');
$task = $taskRepository->find($id);
$em = $this->getDoctrine()->getManager();
$task = $em->getRepository(SingleTask::class)->find($id);
if (!is_null($task->getPerson() === !null)) {
$personId = $task->getPerson()->getId();
@ -297,10 +295,9 @@ class SingleTaskController extends AbstractController
$id,
TranslatorInterface $translator
) {
/* @var $taskRepository SingleTaskRepository */
$taskRepository = $this->get('chill_task.single_task_repository');
$task = $taskRepository->find($id);
$em = $this->getDoctrine()->getManager();
$task = $em->getRepository(SingleTask::class)->find($id);
if (!$task) {
throw $this->createNotFoundException('Unable to find Task entity.');

View File

@ -3,6 +3,7 @@
namespace Chill\TaskBundle\Repository;
use Chill\MainBundle\Entity\User;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Symfony\Component\Security\Core\Role\Role;
@ -11,9 +12,11 @@ use Doctrine\DBAL\Types\Type;
use Chill\MainBundle\Entity\Center;
/**
* SingleTaskRepository
* Class SingleTaskRepository
*
* @package Chill\TaskBundle\Repository
*/
class SingleTaskRepository extends \Doctrine\ORM\EntityRepository
class SingleTaskRepository extends EntityRepository
{
const DATE_STATUS_ENDED = 'ended';