Created
July 11, 2012 12:57
-
-
Save hugoleodev/3090238 to your computer and use it in GitHub Desktop.
Exemplo de uso de services
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Uso ser service class sem service locator | |
*/ | |
class CategoriaProdutoController extends Controller | |
{ | |
public function excluirAction() | |
{ | |
$id = $this->_getParam('id'); | |
$service = new CategoriaProdutoService; | |
$service->excluir($id); | |
} | |
} | |
class CategoriaProdutoService | |
{ | |
public function excluir($id) | |
{ | |
//obtem EntityManager | |
//verifica constraints | |
//faz as devidas operacoes ou dispara excecoes | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment