From f763e2bc9ff1202bc1baa93cad695337b899e26c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Burnichon?= Date: Thu, 21 Jan 2016 16:47:20 +0100 Subject: [PATCH] Collection Hydration should fetch internal services. --- lib/classes/collection.php | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/lib/classes/collection.php b/lib/classes/collection.php index 71bf48b816..ff8aa96f2c 100644 --- a/lib/classes/collection.php +++ b/lib/classes/collection.php @@ -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']; + } }