Advertisement
Guest User

Untitled

a guest
Apr 27th, 2017
543
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Fran Iglesias <franiglesias@mac.com>
  5. * Date: 21/4/17
  6. * Time: 13:22
  7. */
  8.  
  9. namespace Mh13\plugins\contents\infrastructure\persistence\dbal;
  10.  
  11.  
  12. use Doctrine\DBAL\Connection;
  13. use Mh13\plugins\contents\domain\BlogSpecificationFactory;
  14. use Mh13\plugins\contents\infrastructure\persistence\dbal\specification\blog\ActiveBlogWithSlug;
  15. use Mh13\plugins\contents\infrastructure\persistence\dbal\specification\blog\BlogIsActive;
  16. use Mh13\plugins\contents\infrastructure\persistence\dbal\specification\blog\BlogWithSlug;
  17.  
  18.  
  19. class DbalBlogSpecificationFactory implements BlogSpecificationFactory
  20. {
  21. /**
  22. * @var \Doctrine\DBAL\Query\Expression\ExpressionBuilder
  23. */
  24. protected $expressionBuilder;
  25.  
  26. public function __construct(Connection $connection)
  27. {
  28. $this->expressionBuilder = $connection->getExpressionBuilder();
  29. }
  30.  
  31. public function createBlogWithSlug(string $slug)
  32. {
  33. $blogIsActive = new BlogIsActive($this->expressionBuilder);
  34.  
  35. return $blogIsActive->and(new BlogWithSlug($this->expressionBuilder, $slug));
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement