Renaming of Databox{,Field}Repository

This commit is contained in:
Benoît Burnichon
2015-07-08 14:58:41 +02:00
parent 12ca9a48c4
commit dd73d6dae2
11 changed files with 28 additions and 28 deletions

View File

@@ -12,11 +12,11 @@
namespace Alchemy\Phrasea\Core\Provider; namespace Alchemy\Phrasea\Core\Provider;
use Alchemy\Phrasea\Application as PhraseaApplication; use Alchemy\Phrasea\Application as PhraseaApplication;
use Alchemy\Phrasea\Databox\CachedDataboxRepository; use Alchemy\Phrasea\Databox\CachingDataboxRepositoryDecorator;
use Alchemy\Phrasea\Databox\DataboxFactory; use Alchemy\Phrasea\Databox\DataboxFactory;
use Alchemy\Phrasea\Databox\DataboxFieldFactory;
use Alchemy\Phrasea\Databox\DbalDataboxFieldRepository;
use Alchemy\Phrasea\Databox\DbalDataboxRepository; use Alchemy\Phrasea\Databox\DbalDataboxRepository;
use Alchemy\Phrasea\Databox\Field\DataboxFieldFactory;
use Alchemy\Phrasea\Databox\Field\DbalDataboxFieldRepository;
use Silex\Application; use Silex\Application;
use Silex\ServiceProviderInterface; use Silex\ServiceProviderInterface;
@@ -132,7 +132,7 @@ class RepositoriesServiceProvider implements ServiceProviderInterface
$appbox = $app->getApplicationBox(); $appbox = $app->getApplicationBox();
$repository = new DbalDataboxRepository($appbox->get_connection(), $factory); $repository = new DbalDataboxRepository($appbox->get_connection(), $factory);
return new CachedDataboxRepository($repository, $app['cache'], $appbox->get_cache_key($appbox::CACHE_LIST_BASES), $factory); return new CachingDataboxRepositoryDecorator($repository, $app['cache'], $appbox->get_cache_key($appbox::CACHE_LIST_BASES), $factory);
}); });
$app['repo.fields.factory'] = $app->protect(function (\databox $databox) use ($app) { $app['repo.fields.factory'] = $app->protect(function (\databox $databox) use ($app) {

View File

@@ -11,9 +11,9 @@ namespace Alchemy\Phrasea\Databox;
use Doctrine\Common\Cache\Cache; use Doctrine\Common\Cache\Cache;
final class CachedDataboxRepository implements DataboxRepositoryInterface final class CachingDataboxRepositoryDecorator implements DataboxRepository
{ {
/** @var DataboxRepositoryInterface */ /** @var DataboxRepository */
private $repository; private $repository;
/** @var Cache */ /** @var Cache */
private $cache; private $cache;
@@ -22,7 +22,7 @@ final class CachedDataboxRepository implements DataboxRepositoryInterface
/** @var DataboxFactory */ /** @var DataboxFactory */
private $factory; private $factory;
public function __construct(DataboxRepositoryInterface $repository, Cache $cache, $cacheKey, DataboxFactory $factory) public function __construct(DataboxRepository $repository, Cache $cache, $cacheKey, DataboxFactory $factory)
{ {
$this->repository = $repository; $this->repository = $repository;
$this->cache = $cache; $this->cache = $cache;

View File

@@ -9,7 +9,7 @@
*/ */
namespace Alchemy\Phrasea\Databox; namespace Alchemy\Phrasea\Databox;
interface DataboxRepositoryInterface interface DataboxRepository
{ {
/** /**
* @param int $id * @param int $id

View File

@@ -11,7 +11,7 @@ namespace Alchemy\Phrasea\Databox;
use Doctrine\DBAL\Connection; use Doctrine\DBAL\Connection;
final class DbalDataboxRepository implements DataboxRepositoryInterface final class DbalDataboxRepository implements DataboxRepository
{ {
/** @var Connection */ /** @var Connection */
private $connection; private $connection;

View File

@@ -7,7 +7,7 @@
* For the full copyright and license information, please view the LICENSE * For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
namespace Alchemy\Phrasea\Databox; namespace Alchemy\Phrasea\Databox\Field;
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use databox; use databox;

View File

@@ -7,9 +7,9 @@
* For the full copyright and license information, please view the LICENSE * For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
namespace Alchemy\Phrasea\Databox; namespace Alchemy\Phrasea\Databox\Field;
interface DataboxFieldRepositoryInterface interface DataboxFieldRepository
{ {
/** /**
* Find all fields * Find all fields

View File

@@ -7,11 +7,11 @@
* For the full copyright and license information, please view the LICENSE * For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
namespace Alchemy\Phrasea\Databox; namespace Alchemy\Phrasea\Databox\Field;
use Doctrine\DBAL\Connection; use Doctrine\DBAL\Connection;
final class DbalDataboxFieldRepository implements DataboxFieldRepositoryInterface final class DbalDataboxFieldRepository implements DataboxFieldRepository
{ {
private static $columnNames = [ private static $columnNames = [
'id', 'id',

View File

@@ -13,7 +13,7 @@ use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Core\Configuration\AccessRestriction; use Alchemy\Phrasea\Core\Configuration\AccessRestriction;
use Alchemy\Phrasea\Core\Connection\ConnectionSettings; use Alchemy\Phrasea\Core\Connection\ConnectionSettings;
use Alchemy\Phrasea\Core\Version\AppboxVersionRepository; use Alchemy\Phrasea\Core\Version\AppboxVersionRepository;
use Alchemy\Phrasea\Databox\DataboxRepositoryInterface; use Alchemy\Phrasea\Databox\DataboxRepository;
use Doctrine\ORM\Tools\SchemaTool; use Doctrine\ORM\Tools\SchemaTool;
use MediaAlchemyst\Alchemyst; use MediaAlchemyst\Alchemyst;
use MediaAlchemyst\Specification\Image as ImageSpecification; use MediaAlchemyst\Specification\Image as ImageSpecification;
@@ -295,7 +295,7 @@ class appbox extends base
} }
/** /**
* @return DataboxRepositoryInterface * @return DataboxRepository
*/ */
private function getDataboxRepository() private function getDataboxRepository()
{ {

View File

@@ -11,10 +11,11 @@
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Core\Connection\ConnectionSettings; use Alchemy\Phrasea\Core\Connection\ConnectionSettings;
use Alchemy\Phrasea\Core\PhraseaTokens;
use Alchemy\Phrasea\Core\Version\DataboxVersionRepository; use Alchemy\Phrasea\Core\Version\DataboxVersionRepository;
use Alchemy\Phrasea\Databox\DataboxFieldRepositoryInterface; use Alchemy\Phrasea\Databox\Field\DataboxFieldRepository;
use Alchemy\Phrasea\Model\Entities\User;
use Alchemy\Phrasea\Exception\InvalidArgumentException; use Alchemy\Phrasea\Exception\InvalidArgumentException;
use Alchemy\Phrasea\Model\Entities\User;
use Alchemy\Phrasea\Status\StatusStructure; use Alchemy\Phrasea\Status\StatusStructure;
use Alchemy\Phrasea\Status\StatusStructureFactory; use Alchemy\Phrasea\Status\StatusStructureFactory;
use Doctrine\DBAL\Connection; use Doctrine\DBAL\Connection;
@@ -23,7 +24,6 @@ use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpFoundation\File\File; use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Translation\TranslatorInterface; use Symfony\Component\Translation\TranslatorInterface;
use Alchemy\Phrasea\Core\PhraseaTokens;
class databox extends base implements \Alchemy\Phrasea\Core\Thumbnail\ThumbnailedElement class databox extends base implements \Alchemy\Phrasea\Core\Thumbnail\ThumbnailedElement
{ {
@@ -646,7 +646,7 @@ class databox extends base implements \Alchemy\Phrasea\Core\Thumbnail\Thumbnaile
return $this->meta_struct; return $this->meta_struct;
} }
/** @var DataboxFieldRepositoryInterface $fieldRepository */ /** @var \Alchemy\Phrasea\Databox\Field\DataboxFieldRepository $fieldRepository */
$fieldRepository = $this->app['repo.fields.factory']($this); $fieldRepository = $this->app['repo.fields.factory']($this);
$this->meta_struct = new databox_descriptionStructure($fieldRepository->findAll()); $this->meta_struct = new databox_descriptionStructure($fieldRepository->findAll());

View File

@@ -9,9 +9,9 @@
*/ */
namespace Alchemy\Tests\Phrasea\Databox; namespace Alchemy\Tests\Phrasea\Databox;
use Alchemy\Phrasea\Databox\CachedDataboxRepository; use Alchemy\Phrasea\Databox\CachingDataboxRepositoryDecorator;
use Alchemy\Phrasea\Databox\DataboxFactory; use Alchemy\Phrasea\Databox\DataboxFactory;
use Alchemy\Phrasea\Databox\DataboxRepositoryInterface; use Alchemy\Phrasea\Databox\DataboxRepository;
use Doctrine\Common\Cache\Cache; use Doctrine\Common\Cache\Cache;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
@@ -26,16 +26,16 @@ final class CachedDataboxRepositoryTest extends \PHPUnit_Framework_TestCase
/** @var ObjectProphecy */ /** @var ObjectProphecy */
private $repository; private $repository;
/** @var CachedDataboxRepository */ /** @var CachingDataboxRepositoryDecorator */
private $sut; private $sut;
protected function setUp() protected function setUp()
{ {
$this->cache = $this->prophesize(Cache::class); $this->cache = $this->prophesize(Cache::class);
$this->repository = $this->prophesize(DataboxRepositoryInterface::class); $this->repository = $this->prophesize(DataboxRepository::class);
$this->factory = $this->prophesize(DataboxFactory::class); $this->factory = $this->prophesize(DataboxFactory::class);
$this->sut = new CachedDataboxRepository( $this->sut = new CachingDataboxRepositoryDecorator(
$this->repository->reveal(), $this->repository->reveal(),
$this->cache->reveal(), $this->cache->reveal(),
$this->cacheKey, $this->cacheKey,
@@ -45,7 +45,7 @@ final class CachedDataboxRepositoryTest extends \PHPUnit_Framework_TestCase
public function testItImplementsDataboxRepositoryInterface() public function testItImplementsDataboxRepositoryInterface()
{ {
$this->assertInstanceOf(DataboxRepositoryInterface::class, $this->sut); $this->assertInstanceOf(DataboxRepository::class, $this->sut);
} }
public function testItFindsASpecificDataboxWhenNotInCache() public function testItFindsASpecificDataboxWhenNotInCache()

View File

@@ -10,7 +10,7 @@
namespace Alchemy\Tests\Phrasea\Databox; namespace Alchemy\Tests\Phrasea\Databox;
use Alchemy\Phrasea\Databox\DataboxFactory; use Alchemy\Phrasea\Databox\DataboxFactory;
use Alchemy\Phrasea\Databox\DataboxRepositoryInterface; use Alchemy\Phrasea\Databox\DataboxRepository;
use Alchemy\Phrasea\Databox\DbalDataboxRepository; use Alchemy\Phrasea\Databox\DbalDataboxRepository;
use Doctrine\DBAL\Connection; use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver\Statement; use Doctrine\DBAL\Driver\Statement;
@@ -36,7 +36,7 @@ final class DbalDataboxRepositoryTest extends \PHPUnit_Framework_TestCase
public function testItImplementsDataboxRepositoryInterface() public function testItImplementsDataboxRepositoryInterface()
{ {
$this->assertInstanceOf(DataboxRepositoryInterface::class, $this->sut); $this->assertInstanceOf(DataboxRepository::class, $this->sut);
} }
public function testItFindsDataboxProperly() public function testItFindsDataboxProperly()