Skip to content

Commit

Permalink
Adicionado as funcionalidades das rotas
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Xavier committed Sep 6, 2019
1 parent 47cf8cf commit 6907f59
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 7 deletions.
75 changes: 75 additions & 0 deletions config/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,79 @@
$app->get('/', App\Handler\HomePageHandler::class, 'home');
$app->get('/api/ping', App\Handler\PingHandler::class, 'api.ping');
$app->get('/api/test-doctrine-connection', App\Handler\TestDoctrineConnectionHandler::class, 'api.test-doctrine-connection');
$app->get(
'/api/tipos-de-usuarios/listar-todos',
App\Handler\TipoUsuario\TipoUsuarioListarHandler::class,
'api.tipos-de-usuarios.listar-todos'
);
$app->get(
'/api/tipos-de-usuarios/listar-um/{id}',
App\Handler\TipoUsuario\TipoUsuarioListarUmHandler::class,
'api.tipos-de-usuarios.listar-um'
);
$app->post(
'/api/tipos-de-usuarios/criar',
App\Handler\TipoUsuario\TipoUsuarioCriarHandler::class,
'api.tipos-de-usuarios.criar'
);
$app->put(
'/api/tipos-de-usuarios/alterar/{id}',
App\Handler\TipoUsuario\TipoUsuarioAlterarHandler::class,
'api.tipos-de-usuarios.alterar'
);
$app->delete(
'/api/tipos-de-usuarios/deletar/{id}',
App\Handler\TipoUsuario\TipoUsuarioDeletarHandler::class,
'api.tipos-de-usuarios.deletar'
);
$app->get(
'/api/usuarios/listar-todos',
App\Handler\Usuario\UsuarioListarHandler::class,
'api.usuarios.listar-todos'
);
$app->get(
'/api/usuarios/listar-um/{id}',
App\Handler\Usuario\UsuarioListarUmHandler::class,
'api.usuarios.listar-um'
);
$app->post(
'/api/usuarios/criar',
App\Handler\Usuario\UsuarioCriarHandler::class,
'api.usuarios.criar'
);
$app->put(
'/api/usuarios/alterar/{id}',
App\Handler\Usuario\UsuarioAlterarHandler::class,
'api.usuarios.alterar'
);
$app->delete(
'/api/usuarios/deletar/{id}',
App\Handler\Usuario\UsuarioDeletarHandler::class,
'api.usuarios.deletar'
);
$app->get(
'/api/mensagens/listar-todas',
App\Handler\Mensagem\MensagemListarHandler::class,
'api.mensagens.listar-todos'
);
$app->get(
'/api/mensagens/listar-uma/{id}',
App\Handler\Mensagem\MensagemListarUmaHandler::class,
'api.mensagens.listar-uma'
);
$app->post(
'/api/mensagens/criar',
App\Handler\Mensagem\MensagemCriarHandler::class,
'api.mensagens.criar'
);
$app->put(
'/api/mensagens/alterar/{id}',
App\Handler\Mensagem\MensagemAlterarHandler::class,
'api.mensagens.alterar'
);
$app->delete(
'/api/mensagens/deletar/{id}',
App\Handler\Mensagem\MensagemDeletarHandler::class,
'api.mensagens.deletar'
);
};
2 changes: 1 addition & 1 deletion src/App/src/Entity/Mensagem.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;
use Zend\Hydrator\ClassMethods;
use Zend\Hydrator\ClassMethodsHydrator as ClassMethods;

/**
* Mensagem
Expand Down
2 changes: 1 addition & 1 deletion src/App/src/Entity/TipoUsuario.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;
use Zend\Hydrator\ClassMethods;
use Zend\Hydrator\ClassMethodsHydrator as ClassMethods;

/**
* TipoUsuario
Expand Down
2 changes: 1 addition & 1 deletion src/App/src/Entity/Usuario.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;
use Zend\Hydrator\ClassMethods;
use Zend\Hydrator\ClassMethodsHydrator as ClassMethods;

/**
* Usuario
Expand Down
2 changes: 1 addition & 1 deletion src/App/src/Service/MensagemService.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

use App\Entity\Mensagem;
use App\Entity\Usuario;
use Zend\Hydrator\ClassMethods;
use Zend\Hydrator\ClassMethodsHydrator as ClassMethods;

/**
* Class MensagemService
Expand Down
2 changes: 1 addition & 1 deletion src/App/src/Service/ServiceAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace App\Service;

use Doctrine\ORM\EntityManager;
use Zend\Hydrator\ClassMethods;
use Zend\Hydrator\ClassMethodsHydrator as ClassMethods;

/*** Class ServiceAbstract
* @package App\Service
Expand Down
4 changes: 2 additions & 2 deletions src/App/src/Service/UsuarioService.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

use App\Entity\TipoUsuario;
use App\Entity\Usuario;
use Zend\Hydrator\ClassMethods;
use Zend\Hydrator\ClassMethodsHydrator as ClassMethod;

/**
* Class UsuarioService
Expand All @@ -27,7 +27,7 @@ public function insert(array $data)
$userType = $this->em->getReference(TipoUsuario::class, $data['tipoUsuario']);
$data['tipoUsuario'] = $userType;
$data['dataNascimento'] = new \DateTime($data['dataNascimento']);
$classMethods = new ClassMethods();
$classMethods = new ClassMethod();
$classMethods->hydrate($data, $entity);
$this->em->persist($entity);
$this->em->flush();
Expand Down

0 comments on commit 6907f59

Please sign in to comment.