Merge branch 'clean-boxes' into merge-clean-boxes

This commit is contained in:
Thibaud Fabre
2016-01-06 19:53:43 +01:00
56 changed files with 2546 additions and 902 deletions

View File

@@ -10,13 +10,14 @@
*/
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Collection\CollectionService;
use Alchemy\Phrasea\Core\Configuration\AccessRestriction;
use Alchemy\Phrasea\Core\Connection\ConnectionSettings;
use Alchemy\Phrasea\Core\Version\AppboxVersionRepository;
use Alchemy\Phrasea\Databox\DataboxConnectionProvider;
use Alchemy\Phrasea\Databox\DataboxRepository;
use Doctrine\ORM\Tools\SchemaTool;
use MediaAlchemyst\Alchemyst;
use MediaAlchemyst\Specification\Image as ImageSpecification;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpFoundation\File\File as SymfoFile;
use Symfony\Component\Finder\Finder;
@@ -42,6 +43,10 @@ class appbox extends base
* @var \databox[]
*/
protected $databoxes;
/**
* @var CollectionService
*/
protected $collectionService;
public function __construct(Application $app)
{
@@ -258,12 +263,12 @@ class appbox extends base
}
/**
* @param $sbas_id
* @param int $sbas_id
* @return databox
*/
public function get_databox($sbas_id)
{
$databoxes = $this->get_databoxes();
$databoxes = $this->getDataboxRepository()->findAll();
if (!isset($databoxes[$sbas_id]) && !array_key_exists($sbas_id, $databoxes)) {
throw new NotFoundHttpException('Databox `' . $sbas_id . '` not found');
@@ -314,6 +319,19 @@ class appbox extends base
parent::delete_data_from_cache($option);
}
public function getCollectionService()
{
if ($this->collectionService === null) {
$this->collectionService = new CollectionService(
$this->app,
$this->connection,
new DataboxConnectionProvider($this)
);
}
return $this->collectionService;
}
/**
* @return AccessRestriction
*/