mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-10 11:33:17 +00:00
61 lines
1.7 KiB
PHP
61 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace Alchemy\Phrasea\Collection\Factory;
|
|
|
|
use Alchemy\Phrasea\Collection\CollectionFactory;
|
|
use Alchemy\Phrasea\Collection\CollectionRepository;
|
|
use Alchemy\Phrasea\Collection\CollectionRepositoryFactory;
|
|
use Alchemy\Phrasea\Collection\Reference\CollectionReferenceRepository;
|
|
use Alchemy\Phrasea\Collection\Repository\DbalCollectionRepository;
|
|
use Alchemy\Phrasea\Databox\DataboxConnectionProvider;
|
|
|
|
class DbalCollectionRepositoryFactory implements CollectionRepositoryFactory
|
|
{
|
|
|
|
/**
|
|
* @var CollectionReferenceRepository
|
|
*/
|
|
private $collectionReferenceRepository;
|
|
|
|
/**
|
|
* @var DataboxConnectionProvider
|
|
*/
|
|
private $databoxConnectionProvider;
|
|
|
|
/**
|
|
* @var CollectionFactory
|
|
*/
|
|
private $collectionFactory;
|
|
|
|
/**
|
|
* @param DataboxConnectionProvider $connectionProvider
|
|
* @param CollectionFactory $collectionFactory
|
|
* @param CollectionReferenceRepository $referenceRepository
|
|
*/
|
|
public function __construct(
|
|
DataboxConnectionProvider $connectionProvider,
|
|
CollectionFactory $collectionFactory,
|
|
CollectionReferenceRepository $referenceRepository
|
|
) {
|
|
$this->databoxConnectionProvider = $connectionProvider;
|
|
$this->collectionFactory = $collectionFactory;
|
|
$this->collectionReferenceRepository = $referenceRepository;
|
|
}
|
|
|
|
/**
|
|
* @param int $databoxId
|
|
* @return CollectionRepository
|
|
*/
|
|
public function createRepositoryForDatabox($databoxId)
|
|
{
|
|
$connection = $this->databoxConnectionProvider->getConnection($databoxId);
|
|
|
|
return new DbalCollectionRepository(
|
|
$databoxId,
|
|
$connection,
|
|
$this->collectionReferenceRepository,
|
|
$this->collectionFactory
|
|
);
|
|
}
|
|
}
|