diff --git a/Data/tasks.db b/Data/tasks.db
index 57ed5d5..6f45f4c 100644
Binary files a/Data/tasks.db and b/Data/tasks.db differ
diff --git a/composer.json b/composer.json
index aa84db9..8407ef1 100644
--- a/composer.json
+++ b/composer.json
@@ -2,7 +2,7 @@
"type": "project",
"license": "proprietary",
"require": {
- "php": ">=7.1.3",
+ "php": ">=7.4",
"ext-ctype": "*",
"ext-iconv": "*",
"composer/package-versions-deprecated": "1.11.99.1",
diff --git a/config/routes/annotations.yaml b/config/routes/annotations.yaml
index c685c71..5a98b67 100644
--- a/config/routes/annotations.yaml
+++ b/config/routes/annotations.yaml
@@ -1,5 +1,5 @@
controllers:
- resource: ../../src/Infrastructure/Controller/
+ resource: ../../src/Application/Controller/
type: annotation
kernel:
diff --git a/config/services.yaml b/config/services.yaml
index 6a2a1fd..ec28731 100644
--- a/config/services.yaml
+++ b/config/services.yaml
@@ -23,8 +23,8 @@ services:
# controllers are imported separately to make sure services can be injected
# as action arguments even if you don't extend any base controller class
- App\Infrastructure\Controller\:
- resource: '../src/Infrastructure/Controller'
+ App\Application\Controller\:
+ resource: '../src/Application/Controller'
tags: ['controller.service_arguments']
# add more service definitions when explicit configuration is needed
diff --git a/src/Infrastructure/Controller/.gitignore b/src/Application/Controller/.gitignore
similarity index 100%
rename from src/Infrastructure/Controller/.gitignore
rename to src/Application/Controller/.gitignore
diff --git a/src/Infrastructure/Controller/Action/PostAction.php b/src/Application/Controller/Action/PostAction.php
similarity index 92%
rename from src/Infrastructure/Controller/Action/PostAction.php
rename to src/Application/Controller/Action/PostAction.php
index 5a36f94..41f8c15 100644
--- a/src/Infrastructure/Controller/Action/PostAction.php
+++ b/src/Application/Controller/Action/PostAction.php
@@ -1,6 +1,6 @@
projetoService = $projetoService;
+ $this->usuarioRepository = $usuarioRepository;
+ }
+
+
+ /**
+ * @Route("/index", name="index")
+ * @IsGranted("ROLE_ADMIN")
+ */
+ public function index()
+ {
+
+ $numeroProjetos = $this->projetoService->getNumroDeProjetos();
+ $numeroUsuario = $this->usuarioRepository->getNumeroUsers();
+
+ return $this->render(
+ 'index.html.twig',
+ [
+ 'numeroProjeto' => $numeroProjetos,
+ 'numeroUsuarios' => $numeroUsuario
+ ]
+ );
+ }
+
+}
diff --git a/src/Infrastructure/Controller/UsuarioAtribuicaoController.php b/src/Application/Controller/UsuarioController.php
similarity index 66%
rename from src/Infrastructure/Controller/UsuarioAtribuicaoController.php
rename to src/Application/Controller/UsuarioController.php
index 3ee089d..288fdc6 100644
--- a/src/Infrastructure/Controller/UsuarioAtribuicaoController.php
+++ b/src/Application/Controller/UsuarioController.php
@@ -1,34 +1,45 @@
usuarioService = $usuarioService;
+ }
+
/**
* @Route("/tasks" , name="usuario_tasks")
*/
public function listarAtribuicoes()
{
$usuario = $this->getUser();
- $atribuicoes = $this
- ->getDoctrine()
- ->getRepository(UsuarioAtribuicao::class)
- ->findBy(['usuario' => $usuario->getId()])
- ;
+ $atribuicoes = $this->usuarioService.atribuicoes($usuario.getId());
return $this->render('usuario-tasks.html.twig',
[
diff --git a/src/Application/Service/ProjetoServiceImpl.php b/src/Application/Service/ProjetoServiceImpl.php
new file mode 100644
index 0000000..bf6b1be
--- /dev/null
+++ b/src/Application/Service/ProjetoServiceImpl.php
@@ -0,0 +1,53 @@
+projetoRepository = $projetoRepository;
+ }
+
+ /**
+ * @param Projeto $projeto
+ */
+ public function salvar(Projeto $projeto): void
+ {
+ $this->projetoRepository->salvar($projeto);
+ }
+
+ /**
+ * @return array
+ */
+ public function listar(): array
+ {
+ return $this->projetoRepository->listar();
+ }
+
+ /**
+ * @return int
+ */
+ public function getNumeroProjetos(): int
+ {
+ return $this->projetoRepository->getNumeroProjetos();
+ }
+}
diff --git a/src/Application/Service/UsuarioServiceImpl.php b/src/Application/Service/UsuarioServiceImpl.php
new file mode 100644
index 0000000..5357312
--- /dev/null
+++ b/src/Application/Service/UsuarioServiceImpl.php
@@ -0,0 +1,51 @@
+usuarioRepository = $usuarioRepository;
+ }
+
+ public function salvar(Usuario $usuario): void
+ {
+ $this->usuarioRepository->salvar($usuario);
+ }
+
+ public function listar(): array
+ {
+ return $this->usuarioRepository->listar();
+ }
+
+ public function atribuicoes(int $id): array
+ {
+ return $this
+ ->getDoctrine()
+ ->getRepository(UsuarioAtribuicao::class)
+ ->findBy(['usuario' => $id]);
+
+ }
+
+}
\ No newline at end of file
diff --git a/src/Domain/Model/Projeto.php b/src/Domain/Model/Projeto.php
index c82c2e7..5b749e0 100644
--- a/src/Domain/Model/Projeto.php
+++ b/src/Domain/Model/Projeto.php
@@ -5,8 +5,6 @@
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
-use Monolog\Logger;
-use Psr\Log\LoggerInterface;
/**
* @ORM\Entity
diff --git a/src/Domain/Model/ProjetoRepositoryInterface.php b/src/Domain/Model/ProjetoRepositoryInterface.php
deleted file mode 100644
index ee55a03..0000000
--- a/src/Domain/Model/ProjetoRepositoryInterface.php
+++ /dev/null
@@ -1,14 +0,0 @@
-projetoRepository = $projetoRepository;
- }
-
- /**
- * @param Projeto $projeto
- */
- public function salvar(Projeto $projeto)
- {
- $this->projetoRepository->salvar($projeto);
- }
-
- /**
- * @return array
- */
- public function listar(): array
- {
- return $this->projetoRepository->listar();
- }
-}
diff --git a/src/Infrastructure/Command/AddUserCommand.php b/src/Infrastructure/Command/AddUserCommand.php
index e8e6c01..5933cc7 100755
--- a/src/Infrastructure/Command/AddUserCommand.php
+++ b/src/Infrastructure/Command/AddUserCommand.php
@@ -12,7 +12,7 @@
namespace App\Infrastructure\Command;
use App\Domain\Model\Usuario;
-use App\Infrastructure\Repository\UsuarioRepository;
+use App\Infrastructure\Repository\UsuarioRepositoryImpl;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
@@ -38,7 +38,7 @@ class AddUserCommand extends Command
private $entityManager;
private $users;
- public function __construct(EntityManagerInterface $em, UsuarioRepository $users)
+ public function __construct(EntityManagerInterface $em, UsuarioRepositoryImpl $users)
{
parent::__construct();
diff --git a/src/Infrastructure/Controller/TasksTrackerController.php b/src/Infrastructure/Controller/TasksTrackerController.php
deleted file mode 100644
index b230c5c..0000000
--- a/src/Infrastructure/Controller/TasksTrackerController.php
+++ /dev/null
@@ -1,62 +0,0 @@
-get('doctrine');
-
-
-// $status = $doctrine->getManager()->getRepository(Status::class)->find(1);
-//
-// $task = new Task();
-// $task->setStatus($status);
-// $task->setNome("Criar Crud para os status");
-// $task->setDescircao("Possibilitar o gerente da empresa adicionar um status para as tasks");
-// $task->setDtCadastro(new \DateTime());
-// $projeto->addTask($task);
-// $task->setProjeto($projeto);
-
-// $usuario = new Usuario();
-// $usuario->setNome('Hélio Cardoso');
-// $usuario->setEmail('heliosouza@gmail.com');
-// $usuario->setRoles(['ROLE_ADMIM1']);
-//
-
-
-
- $result = $doctrine->getRepository(Usuario::class)->findAll();
- dump($result);exit;
- }
-
- /**
- * @Route("/index", name="index")
- * @IsGranted("ROLE_ADMIN")
- */
- public function index()
- {
- return $this->render('index.html.twig');
- }
-
-}
diff --git a/src/Infrastructure/Repository/ProjetoRepository.php b/src/Infrastructure/Repository/ProjetoRepository.php
index 4393401..c2303fb 100644
--- a/src/Infrastructure/Repository/ProjetoRepository.php
+++ b/src/Infrastructure/Repository/ProjetoRepository.php
@@ -3,37 +3,16 @@
namespace App\Infrastructure\Repository;
use App\Domain\Model\Projeto;
-use App\Domain\Model\ProjetoRepositoryInterface;
-use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
-use Doctrine\Persistence\ManagerRegistry;
/**
- * Class ProjetoRepository
+ * class ProjetoRepository
* @package App\Infrastructure\Repository
*/
-class ProjetoRepository extends ServiceEntityRepository implements ProjetoRepositoryInterface
+interface ProjetoRepository
{
- public function __construct(ManagerRegistry $registry)
- {
- parent::__construct($registry, Projeto::class);
- }
+ public function salvar(Projeto $projeto): void;
- /**
- * @param Projeto $projeto
- * @throws \Doctrine\ORM\ORMException
- * @throws \Doctrine\ORM\OptimisticLockException
- */
- public function salvar(Projeto $projeto): void
- {
- $this->getEntityManager()->persist($projeto);
- $this->getEntityManager()->flush();
- }
+ public function listar(): array;
- /**
- * @return array
- */
- public function listar(): array
- {
- return $this->findAll();
- }
+ public function getNumeroProjetos(): int;
}
diff --git a/src/Infrastructure/Repository/ProjetoRepositoryImpl.php b/src/Infrastructure/Repository/ProjetoRepositoryImpl.php
new file mode 100644
index 0000000..be47a16
--- /dev/null
+++ b/src/Infrastructure/Repository/ProjetoRepositoryImpl.php
@@ -0,0 +1,56 @@
+getEntityManager()->persist($projeto);
+ $this->getEntityManager()->flush();
+ }
+
+ /**
+ * @return array
+ */
+ public function listar(): array
+ {
+ return $this->findAll();
+ }
+
+ /**
+ * @return int
+ * @throws NoResultException
+ * @throws NonUniqueResultException
+ */
+ public function getNumeroProjetos(): int
+ {
+ $queryBuilder = $this->createQueryBuilder("pro");
+ $queryBuilder
+ ->select($queryBuilder->expr()->count("pro"));
+
+ return $queryBuilder->getQuery()->getSingleScalarResult();
+ }
+}
diff --git a/src/Infrastructure/Repository/UsuarioAtribuicaoRepository.php b/src/Infrastructure/Repository/UsuarioAtribuicaoRepository.php
new file mode 100644
index 0000000..19826a3
--- /dev/null
+++ b/src/Infrastructure/Repository/UsuarioAtribuicaoRepository.php
@@ -0,0 +1,40 @@
+createQueryBuilder("userAtrib");
+
+ $queryBuilder
+ ->select(
+ [
+ 'userAtrib.status',
+ $queryBuilder->expr()->count("userAtrib")
+ ]
+ )->groupBy('userAtrib.status')
+ ;
+
+ return $queryBuilder->getQuery()->execute();
+ }
+}
diff --git a/src/Infrastructure/Repository/UsuarioRepository.php b/src/Infrastructure/Repository/UsuarioRepository.php
index 524680c..fae0d7c 100644
--- a/src/Infrastructure/Repository/UsuarioRepository.php
+++ b/src/Infrastructure/Repository/UsuarioRepository.php
@@ -3,48 +3,14 @@
namespace App\Infrastructure\Repository;
use App\Domain\Model\Usuario;
-use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
-use Doctrine\Persistence\ManagerRegistry;
/**
- * @method Usuario|null find($id, $lockMode = null, $lockVersion = null)
- * @method Usuario|null findOneBy(array $criteria, array $orderBy = null)
- * @method Usuario[] findAll()
- * @method Usuario[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
+ * class UsuarioRepository
+ * @package App\Infrastructure\Repository
*/
-class UsuarioRepository extends ServiceEntityRepository
+interface UsuarioRepository
{
- public function __construct(ManagerRegistry $registry)
- {
- parent::__construct($registry, Usuario::class);
- }
+ public function salvar(Usuario $usuario): void;
- // /**
- // * @return Usuario[] Returns an array of Usuario objects
- // */
- /*
- public function findByExampleField($value)
- {
- return $this->createQueryBuilder('u')
- ->andWhere('u.exampleField = :val')
- ->setParameter('val', $value)
- ->orderBy('u.id', 'ASC')
- ->setMaxResults(10)
- ->getQuery()
- ->getResult()
- ;
- }
- */
-
- /*
- public function findOneBySomeField($value): ?Usuario
- {
- return $this->createQueryBuilder('u')
- ->andWhere('u.exampleField = :val')
- ->setParameter('val', $value)
- ->getQuery()
- ->getOneOrNullResult()
- ;
- }
- */
+ public function listar(): array;
}
diff --git a/src/Infrastructure/Repository/UsuarioRepositoryImpl.php b/src/Infrastructure/Repository/UsuarioRepositoryImpl.php
new file mode 100644
index 0000000..aaff5a1
--- /dev/null
+++ b/src/Infrastructure/Repository/UsuarioRepositoryImpl.php
@@ -0,0 +1,36 @@
+findAll();
+ }
+
+ public function salvar(Usuario $usuario): void
+ {
+ $this->getEntityManager()->persist($usuario);
+ $this->getEntityManager()->flush();
+ }
+
+}
diff --git a/templates/index.html.twig b/templates/index.html.twig
index 03e6919..e82dea2 100644
--- a/templates/index.html.twig
+++ b/templates/index.html.twig
@@ -45,7 +45,7 @@
Número de Usuários
-
5.000
+
{{ numeroUsuarios }}
@@ -65,12 +65,12 @@
-
73%
+
{{ numeroProjeto }}
@@ -92,7 +92,7 @@
Projetos Ativos
-
18
+
{{ numeroProjeto }}
diff --git a/templates/lista-projetos.html.twig b/templates/lista-projetos.html.twig
index 65ee7b4..b7e6e3e 100644
--- a/templates/lista-projetos.html.twig
+++ b/templates/lista-projetos.html.twig
@@ -1,57 +1,65 @@
{% include 'header.html.twig' %}
-
-
-
-
-
-
-
-
- | Nome |
- Descricao |
- Gerente |
- Data Cadastro |
- |
-
-
-
-
- | Nome |
- Descricao |
- Gerente |
- Data Cadastro |
- |
-
-
-
- {% for projeto in projetos %}
-
- | {{ projeto.nome }} |
- {{ projeto.descricao }} |
- {{ projeto.gerente }} |
- {{ projeto.dtCadastro| date("m/d/Y") }} |
-
-
-
-
-
-
-
- |
-
+
+
+
+
+
+
+
+
+ | Nome |
+ Descricao |
+ Gerente |
+ Data Cadastro |
+ |
+
+
+
+
+ | Nome |
+ Descricao |
+ Gerente |
+ Data Cadastro |
+ |
+
+
+
+ {% for projeto in projetos %}
+
+ | {{ projeto.nome }} |
+ {{ projeto.descricao }} |
+ {{ projeto.gerente }} |
+ {{ projeto.dtCadastro| date("m/d/Y") }} |
+
+
+
+
+
+ Detalhes
+
- {% endfor %}
- |
-
-
-
-
-
-
+
+
+
+
+ Editar
+
+
+
+ {% endfor %}
+
+
+
+
+
+
+
+
{% include 'footer.html.twig' %}
diff --git a/templates/novo-projeto.html.twig b/templates/novo-projeto.html.twig
index 717e35e..594ce92 100644
--- a/templates/novo-projeto.html.twig
+++ b/templates/novo-projeto.html.twig
@@ -1,29 +1,40 @@
{% include 'header.html.twig' %}
-
-
Cadastrar Novo Projeto
- {{ form_start(form) }}
-
-
- {{ form_row(form.nome) }}
-
+
+
Cadastrar Novo Projeto
+ {{ form_start(form) }}
+
+
+ {{ form_row(form.nome) }}
-
-
- {{ form_row(form.descricao) }}
-
+
+
+
+ {{ form_row(form.descricao) }}
-
-
- {{ form_row(form.dtCadastro) }}
-
+
+
+
+ {{ form_row(form.dtCadastro) }}
-
-
- {{ form_row(form.gerente) }}
-
+
+
+
+ {{ form_row(form.gerente) }}
-
+
+
+
+
+ Voltar
+
+
+
{% include 'footer.html.twig' %}
diff --git a/templates/novo-task.html.twig b/templates/novo-task.html.twig
index aa3e3ba..f6cd9d6 100644
--- a/templates/novo-task.html.twig
+++ b/templates/novo-task.html.twig
@@ -1,46 +1,46 @@
{% include 'header.html.twig' %}
-
-
Cadastrar Nova Task
- {{ form_start(form) }}
-
-
- {{ form_row(form.nome) }}
-
+
+
Cadastrar Nova Task
+ {{ form_start(form) }}
+
+
+ {{ form_row(form.nome) }}
-
-
- {{ form_row(form.descricao) }}
-
-
-
-
- {{ form_row(form.dtCadastro) }}
-
+
+
+
+ {{ form_row(form.descricao) }}
-
-
- {{ form_row(form.dtConclusao, ) }}
-
+
+
+
+ {{ form_row(form.dtCadastro) }}
-
-
- {{ form_row(form.status) }}
-
+
+
+
+
+ {{ form_row(form.status) }}
+
+
+
+
+
+ Voltar
+
+
+
+
{% include 'footer.html.twig' %}
diff --git a/templates/projeto.html.twig b/templates/projeto.html.twig
index f1c22ff..365c252 100644
--- a/templates/projeto.html.twig
+++ b/templates/projeto.html.twig
@@ -1,95 +1,100 @@
{% include 'header.html.twig' %}
-
+
-
+
-
+
{% include 'footer.html.twig' %}