mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
Refactor collection repositories: use one instance per databox
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Alchemy\Phrasea\Collection\Factory;
|
||||
|
||||
use Alchemy\Phrasea\Collection\CollectionRepository;
|
||||
use Alchemy\Phrasea\Collection\CollectionRepositoryFactory;
|
||||
use Alchemy\Phrasea\Collection\Repository\ArrayCacheCollectionRepository;
|
||||
|
||||
class ArrayCachedCollectionRepositoryFactory implements CollectionRepositoryFactory
|
||||
{
|
||||
/**
|
||||
* @var CollectionRepositoryFactory
|
||||
*/
|
||||
private $collectionRepositoryFactory;
|
||||
|
||||
/**
|
||||
* @param CollectionRepositoryFactory $collectionRepositoryFactory
|
||||
*/
|
||||
public function __construct(CollectionRepositoryFactory $collectionRepositoryFactory)
|
||||
{
|
||||
$this->collectionRepositoryFactory = $collectionRepositoryFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $databoxId
|
||||
* @return CollectionRepository
|
||||
*/
|
||||
public function createRepositoryForDatabox($databoxId)
|
||||
{
|
||||
$repository = $this->collectionRepositoryFactory->createRepositoryForDatabox($databoxId);
|
||||
|
||||
return new ArrayCacheCollectionRepository($repository);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user