Advertisement
Guest User

Untitled

a guest
Oct 4th, 2015
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. <?php
  2.  
  3. class ArticleNew implements Article
  4. {
  5. function __construct($name, $content, User $author)
  6. {}
  7.  
  8. function getName()
  9. {}
  10.  
  11. function getContent()
  12. {}
  13.  
  14. function getAuthor()
  15. {}
  16. }
  17.  
  18.  
  19. class ArticleCreateService
  20. {
  21. function __construct(AclReader $acl, ArticleCreatePersistence $articleCreate)
  22. {}
  23.  
  24.  
  25.  
  26. function doPersist(Article $article)
  27. {
  28. $acl = $this->acl->read($article->getAuthor());
  29. $acl->assert('create-article');
  30.  
  31. $this->articleCreate->doPersist($article);
  32. }
  33.  
  34. }
  35.  
  36.  
  37.  
  38. class ArticleCreateDatebase implements ArticleCreatePersistence
  39. {
  40. function __construct(DBContext $db)
  41. {}
  42.  
  43.  
  44.  
  45. function doPersist(Article $article)
  46. {
  47. $this->db->insert([
  48. 'name' => $article->getName(),
  49. 'content' => $article->getContent(),
  50. 'id_author' => $article->getAuthor()->getId(),
  51. ]);
  52. }
  53.  
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement