Skip to content

Instantly share code, notes, and snippets.

@hugoleodev
Created July 11, 2012 12:57
Show Gist options
  • Save hugoleodev/3090238 to your computer and use it in GitHub Desktop.
Save hugoleodev/3090238 to your computer and use it in GitHub Desktop.
Exemplo de uso de services
<?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