Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class ArticleNew implements Article
- {
- function __construct($name, $content, User $author)
- {}
- function getName()
- {}
- function getContent()
- {}
- function getAuthor()
- {}
- }
- class ArticleCreateService
- {
- function __construct(AclReader $acl, ArticleCreatePersistence $articleCreate)
- {}
- function doPersist(Article $article)
- {
- $acl = $this->acl->read($article->getAuthor());
- $acl->assert('create-article');
- $this->articleCreate->doPersist($article);
- }
- }
- class ArticleCreateDatebase implements ArticleCreatePersistence
- {
- function __construct(DBContext $db)
- {}
- function doPersist(Article $article)
- {
- $this->db->insert([
- 'name' => $article->getName(),
- 'content' => $article->getContent(),
- 'id_author' => $article->getAuthor()->getId(),
- ]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement