Collection Hydration should fetch internal services.

This commit is contained in:
Benoît Burnichon
2016-01-21 16:47:20 +01:00
parent e95d83169b
commit f763e2bc9f

View File

@@ -278,13 +278,10 @@ class collection implements ThumbnailedElement, cache_cacheableInterface
*/
public function __construct(Application $app, CollectionVO $collection, CollectionReference $reference)
{
$this->app = $app;
$this->databox = $app->getApplicationBox()->get_databox($reference->getDataboxId());
$this->collectionService = $app->getApplicationBox()->getCollectionService();
$this->collectionRepositoryRegistry = $app['repo.collections-registry'];
$this->collectionVO = $collection;
$this->reference = $reference;
$this->fetchInternalServices($app);
}
/**
@@ -314,9 +311,7 @@ class collection implements ThumbnailedElement, cache_cacheableInterface
public function hydrate(Application $app)
{
$this->app = $app;
$this->databox = $app->getApplicationBox()->get_databox($this->reference->getDataboxId());
$this->collectionService = $app->getApplicationBox()->getCollectionService();
$this->fetchInternalServices($app);
}
public function __sleep()
@@ -810,4 +805,15 @@ class collection implements ThumbnailedElement, cache_cacheableInterface
{
$this->databox->delete_data_from_cache($this->get_cache_key($option));
}
/**
* @param Application $app
*/
private function fetchInternalServices(Application $app)
{
$this->app = $app;
$this->databox = $app->getApplicationBox()->get_databox($this->reference->getDataboxId());
$this->collectionService = $app->getApplicationBox()->getCollectionService();
$this->collectionRepositoryRegistry = $app['repo.collections-registry'];
}
}