Advertisement
Guest User

Untitled

a guest
Jun 30th, 2015
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. # app/config/config.yml
  2. # AdminLog Configuration
  3. services:
  4. admin_log:
  5. class: xyzBundleCoreBundleServiceAdminLogService
  6. arguments: [@doctrine.orm.entity_manager]
  7.  
  8. <?php
  9. namespace xyzBundleCoreBundleService;
  10. use xyzBundleCoreBundleEntityAdminLog;
  11.  
  12. class AdminLogService
  13. {
  14. protected $em;
  15.  
  16. public function __construct(DoctrineORMEntityManager $em)
  17. {
  18. $this->em = $em;
  19. }
  20.  
  21. public function logActivity($controller, $action, $entityName, $note)
  22. {
  23. $adminLog = new AdminLog(
  24. 1,
  25. $controller,
  26. $action,
  27. $entityName,
  28. $note
  29. );
  30. $this->em->persist($adminLog);
  31. $this->em->flush();
  32. }
  33.  
  34. }
  35.  
  36. $this->get('admin_log')->logActivity('Website', 'index', 'Test', 'Note here...');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement