vendor/ezsystems/ezplatform-kernel/eZ/Publish/Core/Persistence/Cache/Handler.php line 33

Open in your IDE?
  1. <?php
  2. /**
  3.  * @copyright Copyright (C) Ibexa AS. All rights reserved.
  4.  * @license For full copyright and license information view LICENSE file distributed with this source code.
  5.  */
  6. declare(strict_types=1);
  7. namespace eZ\Publish\Core\Persistence\Cache;
  8. use eZ\Publish\SPI\Persistence\Handler as PersistenceHandlerInterface;
  9. use eZ\Publish\Core\Persistence\Cache\SectionHandler as CacheSectionHandler;
  10. use eZ\Publish\Core\Persistence\Cache\LocationHandler as CacheLocationHandler;
  11. use eZ\Publish\Core\Persistence\Cache\ContentHandler as CacheContentHandler;
  12. use eZ\Publish\Core\Persistence\Cache\ContentLanguageHandler as CacheContentLanguageHandler;
  13. use eZ\Publish\Core\Persistence\Cache\ContentTypeHandler as CacheContentTypeHandler;
  14. use eZ\Publish\Core\Persistence\Cache\UserHandler as CacheUserHandler;
  15. use eZ\Publish\Core\Persistence\Cache\TransactionHandler as CacheTransactionHandler;
  16. use eZ\Publish\Core\Persistence\Cache\TrashHandler as CacheTrashHandler;
  17. use eZ\Publish\Core\Persistence\Cache\UrlAliasHandler as CacheUrlAliasHandler;
  18. use eZ\Publish\Core\Persistence\Cache\ObjectStateHandler as CacheObjectStateHandler;
  19. use eZ\Publish\Core\Persistence\Cache\URLHandler as CacheUrlHandler;
  20. use eZ\Publish\Core\Persistence\Cache\BookmarkHandler as CacheBookmarkHandler;
  21. use eZ\Publish\Core\Persistence\Cache\NotificationHandler as CacheNotificationHandler;
  22. use eZ\Publish\Core\Persistence\Cache\UserPreferenceHandler as CacheUserPreferenceHandler;
  23. use eZ\Publish\Core\Persistence\Cache\UrlWildcardHandler as CacheUrlWildcardHandler;
  24. use eZ\Publish\Core\Persistence\Cache\SettingHandler as SettingHandler;
  25. use eZ\Publish\SPI\Persistence\Setting\Handler as SPISettingHandler;
  26. /**
  27.  * Persistence Cache Handler class.
  28.  */
  29. class Handler implements PersistenceHandlerInterface
  30. {
  31.     /** @var \eZ\Publish\SPI\Persistence\Handler */
  32.     protected $persistenceHandler;
  33.     /** @var \eZ\Publish\Core\Persistence\Cache\SectionHandler */
  34.     protected $sectionHandler;
  35.     /** @var \eZ\Publish\Core\Persistence\Cache\ContentHandler */
  36.     protected $contentHandler;
  37.     /** @var \eZ\Publish\Core\Persistence\Cache\ContentLanguageHandler */
  38.     protected $contentLanguageHandler;
  39.     /** @var \eZ\Publish\Core\Persistence\Cache\ContentTypeHandler */
  40.     protected $contentTypeHandler;
  41.     /** @var \eZ\Publish\Core\Persistence\Cache\LocationHandler */
  42.     protected $locationHandler;
  43.     /** @var \eZ\Publish\Core\Persistence\Cache\UserHandler */
  44.     protected $userHandler;
  45.     /** @var \eZ\Publish\Core\Persistence\Cache\TrashHandler */
  46.     protected $trashHandler;
  47.     /** @var \eZ\Publish\Core\Persistence\Cache\UrlAliasHandler */
  48.     protected $urlAliasHandler;
  49.     /** @var \eZ\Publish\Core\Persistence\Cache\ObjectStateHandler */
  50.     protected $objectStateHandler;
  51.     /** @var \eZ\Publish\Core\Persistence\Cache\TransactionHandler */
  52.     protected $transactionHandler;
  53.     /** @var \eZ\Publish\Core\Persistence\Cache\URLHandler */
  54.     protected $urlHandler;
  55.     /** @var \eZ\Publish\Core\Persistence\Cache\BookmarkHandler */
  56.     protected $bookmarkHandler;
  57.     /** @var \eZ\Publish\Core\Persistence\Cache\NotificationHandler */
  58.     protected $notificationHandler;
  59.     /** @var \eZ\Publish\Core\Persistence\Cache\UserPreferenceHandler */
  60.     protected $userPreferenceHandler;
  61.     /** @var \eZ\Publish\Core\Persistence\Cache\UrlWildcardHandler */
  62.     private $urlWildcardHandler;
  63.     /** @var \eZ\Publish\Core\Persistence\Cache\PersistenceLogger */
  64.     protected $logger;
  65.     /** @var \eZ\Publish\Core\Persistence\Cache\SettingHandler */
  66.     private $settingHandler;
  67.     /**
  68.      * @param \eZ\Publish\SPI\Persistence\Handler $persistenceHandler Must be factory for inner persistence, ie: legacy
  69.      * @param \eZ\Publish\Core\Persistence\Cache\SectionHandler $sectionHandler
  70.      * @param \eZ\Publish\Core\Persistence\Cache\LocationHandler $locationHandler
  71.      * @param \eZ\Publish\Core\Persistence\Cache\ContentHandler $contentHandler
  72.      * @param \eZ\Publish\Core\Persistence\Cache\ContentLanguageHandler $contentLanguageHandler
  73.      * @param \eZ\Publish\Core\Persistence\Cache\ContentTypeHandler $contentTypeHandler
  74.      * @param \eZ\Publish\Core\Persistence\Cache\UserHandler $userHandler
  75.      * @param \eZ\Publish\Core\Persistence\Cache\TransactionHandler $transactionHandler
  76.      * @param \eZ\Publish\Core\Persistence\Cache\TrashHandler $trashHandler
  77.      * @param \eZ\Publish\Core\Persistence\Cache\UrlAliasHandler $urlAliasHandler
  78.      * @param \eZ\Publish\Core\Persistence\Cache\ObjectStateHandler $objectStateHandler
  79.      * @param \eZ\Publish\Core\Persistence\Cache\URLHandler $urlHandler
  80.      * @param \eZ\Publish\Core\Persistence\Cache\BookmarkHandler $bookmarkHandler
  81.      * @param \eZ\Publish\Core\Persistence\Cache\NotificationHandler $notificationHandler
  82.      * @param \eZ\Publish\Core\Persistence\Cache\UserPreferenceHandler $userPreferenceHandler
  83.      * @param \eZ\Publish\Core\Persistence\Cache\UrlWildcardHandler $urlWildcardHandler
  84.      * @param \eZ\Publish\Core\Persistence\Cache\PersistenceLogger $logger
  85.      */
  86.     public function __construct(
  87.         PersistenceHandlerInterface $persistenceHandler,
  88.         CacheSectionHandler $sectionHandler,
  89.         CacheLocationHandler $locationHandler,
  90.         CacheContentHandler $contentHandler,
  91.         CacheContentLanguageHandler $contentLanguageHandler,
  92.         CacheContentTypeHandler $contentTypeHandler,
  93.         CacheUserHandler $userHandler,
  94.         CacheTransactionHandler $transactionHandler,
  95.         CacheTrashHandler $trashHandler,
  96.         CacheUrlAliasHandler $urlAliasHandler,
  97.         CacheObjectStateHandler $objectStateHandler,
  98.         CacheUrlHandler $urlHandler,
  99.         CacheBookmarkHandler $bookmarkHandler,
  100.         CacheNotificationHandler $notificationHandler,
  101.         CacheUserPreferenceHandler $userPreferenceHandler,
  102.         CacheUrlWildcardHandler $urlWildcardHandler,
  103.         SettingHandler $settingHandler,
  104.         PersistenceLogger $logger
  105.     ) {
  106.         $this->persistenceHandler $persistenceHandler;
  107.         $this->sectionHandler $sectionHandler;
  108.         $this->locationHandler $locationHandler;
  109.         $this->contentHandler $contentHandler;
  110.         $this->contentLanguageHandler $contentLanguageHandler;
  111.         $this->contentTypeHandler $contentTypeHandler;
  112.         $this->userHandler $userHandler;
  113.         $this->transactionHandler $transactionHandler;
  114.         $this->trashHandler $trashHandler;
  115.         $this->urlAliasHandler $urlAliasHandler;
  116.         $this->objectStateHandler $objectStateHandler;
  117.         $this->urlHandler $urlHandler;
  118.         $this->bookmarkHandler $bookmarkHandler;
  119.         $this->notificationHandler $notificationHandler;
  120.         $this->userPreferenceHandler $userPreferenceHandler;
  121.         $this->urlWildcardHandler $urlWildcardHandler;
  122.         $this->settingHandler $settingHandler;
  123.         $this->logger $logger;
  124.     }
  125.     /**
  126.      * @return \eZ\Publish\SPI\Persistence\Content\Handler
  127.      */
  128.     public function contentHandler()
  129.     {
  130.         return $this->contentHandler;
  131.     }
  132.     /**
  133.      * @return \eZ\Publish\SPI\Persistence\Content\Type\Handler
  134.      */
  135.     public function contentTypeHandler()
  136.     {
  137.         return $this->contentTypeHandler;
  138.     }
  139.     /**
  140.      * @return \eZ\Publish\SPI\Persistence\Content\Language\Handler
  141.      */
  142.     public function contentLanguageHandler()
  143.     {
  144.         return $this->contentLanguageHandler;
  145.     }
  146.     /**
  147.      * @return \eZ\Publish\SPI\Persistence\Content\Location\Handler
  148.      */
  149.     public function locationHandler()
  150.     {
  151.         return $this->locationHandler;
  152.     }
  153.     /**
  154.      * @return \eZ\Publish\SPI\Persistence\Content\ObjectState\Handler
  155.      */
  156.     public function objectStateHandler()
  157.     {
  158.         return $this->objectStateHandler;
  159.     }
  160.     /**
  161.      * @return \eZ\Publish\SPI\Persistence\User\Handler
  162.      */
  163.     public function userHandler()
  164.     {
  165.         return $this->userHandler;
  166.     }
  167.     /**
  168.      * @return \eZ\Publish\SPI\Persistence\Content\Section\Handler
  169.      */
  170.     public function sectionHandler()
  171.     {
  172.         return $this->sectionHandler;
  173.     }
  174.     /**
  175.      * @return \eZ\Publish\SPI\Persistence\Content\Location\Trash\Handler
  176.      */
  177.     public function trashHandler()
  178.     {
  179.         return $this->trashHandler;
  180.     }
  181.     /**
  182.      * @return \eZ\Publish\SPI\Persistence\Content\UrlAlias\Handler
  183.      */
  184.     public function urlAliasHandler()
  185.     {
  186.         return $this->urlAliasHandler;
  187.     }
  188.     /**
  189.      * @return \eZ\Publish\SPI\Persistence\Content\UrlWildcard\Handler
  190.      */
  191.     public function urlWildcardHandler()
  192.     {
  193.         return $this->urlWildcardHandler;
  194.     }
  195.     /**
  196.      * @return \eZ\Publish\SPI\Persistence\TransactionHandler
  197.      */
  198.     public function transactionHandler()
  199.     {
  200.         return $this->transactionHandler;
  201.     }
  202.     public function settingHandler(): SPISettingHandler
  203.     {
  204.         return $this->settingHandler;
  205.     }
  206.     /**
  207.      * @return \eZ\Publish\Core\Persistence\Cache\URLHandler
  208.      */
  209.     public function urlHandler()
  210.     {
  211.         return $this->urlHandler;
  212.     }
  213.     /**
  214.      * @return \eZ\Publish\Core\Persistence\Cache\BookmarkHandler
  215.      */
  216.     public function bookmarkHandler()
  217.     {
  218.         return $this->bookmarkHandler;
  219.     }
  220.     /**
  221.      * @return \eZ\Publish\Core\Persistence\Cache\NotificationHandler
  222.      */
  223.     public function notificationHandler()
  224.     {
  225.         return $this->notificationHandler;
  226.     }
  227.     /**
  228.      * @return \eZ\Publish\Core\Persistence\Cache\UserPreferenceHandler
  229.      */
  230.     public function userPreferenceHandler()
  231.     {
  232.         return $this->userPreferenceHandler;
  233.     }
  234.     /**
  235.      * {@inheritdoc}
  236.      */
  237.     public function beginTransaction()
  238.     {
  239.         $this->transactionHandler->beginTransaction();
  240.     }
  241.     /**
  242.      * {@inheritdoc}
  243.      */
  244.     public function commit()
  245.     {
  246.         $this->transactionHandler->commit();
  247.     }
  248.     /**
  249.      * {@inheritdoc}
  250.      */
  251.     public function rollback()
  252.     {
  253.         $this->transactionHandler->rollback();
  254.     }
  255. }